Need help on Restrict Possible Usernames

Need help on Restrict Possible Usernames
0.0 0

#1

Tell us what’s happening:
Don’t know why the regular expression code not working.
I used regexr it showing correctly.
redexr link : https://regexr.com/3qiq4

Your code so far


let username = "JackOfAllTrades";
let userCheck = /[a-z]+\w+/gi; // Change this line
let result = userCheck.test(username);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames


#2

Take a look at regexr again. It shows that the capital ‘J’ is not matching with this regex. Make sure to copy/paste the string to avoid typos


#3

look I think its working properly on regexr. but in fcc challenge it can’t match “JACK” and “RegexGuru”


#4

1


#5


after running literal expression it can’t find.


#8

Never mind my previous advice. I got it to work on my mobile browser. Don’t know why it was wrong on my desktop yesterday.

Try clearing your cookies. Sometimes fcc database gets corrupted


#9

Tried clearing cookies even cache still not working.


#10

It’s weird. It looks like they’re looking for a very specific regex, which you had so I can get it to pass with this

/[a-z]/gi


#11

i found the solution. I remove “g” flag and it worked.


#12

let userCheck = /[a-z]\w/gi;


#13

Do you know why this is the case? After reading this, that’s what I had to do for mine as well


#14

I don’t know may be it is a word so “g” flag is unnecessary.