Restrict Possible Usernames - what is wrong?

There’s another typo there it should be [\d]+$ :frowning: sorry for the confusion. (I was editing back and forth)

So, [\d] matches any single digit. + further specifies quantity, and $ checks if previous pattern is true at the end. Together, they read as match a sequence that ends with at least one digit. In general, anything inside [] is treated as a literal character and anything else have speical meaning depending on some context.

I learned Regex from MDN and a couple of chapters from the book “Mastering Regular Expression”. This source is good as well, http://www.grymoire.com/Unix/Regular.html

I don’t really think the exercise was fair for someone just learning Regex.

1 Like