Tell us what’s happening:
Describe your issue in detail here.
Hi everyone, could some explain please why this regex isn’t satisfactory?
It passes all tests except these two:
BadUs3rnam3 (matches but shouldn’t)
Z97 (matches but shouldn’t)
I would seem that, this is because my regex allows somehow numbers to be inserted in the middle of the string, but shouldn’t my regex prevent exactly this with the phrase
Why is it allowing non-letters in the middle?
Your code so far
let username = "JackOfAllTrades"; // let userCheck = /^[a-z][a-z]+[\w]*$/i; let result = userCheck.test(username); //\w - only alphanumeric //\d*$ OR ^[^0-9] //i
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Challenge: Regular Expressions - Restrict Possible Usernames
Link to the challenge: