I want use \\w
regex for to allow alpha numeric but I don\'t want underscore _
to be part of it. Since _
is included in \\w
Your proposed solution:
(/^roger\w{2,3}[0-9a-z]/i)
Means:
\w{2,3}
-- 2 or 3 alphanumeric, including the _
[0-9a-z]
(with the /i) -- a single character that is alphanumeric, not including the _
I didn't see any mention of the acceptable 3 alphanumerics at the beginning. Does that belong?
Both "roger54" and "roger4a" should fail this because the above regex requires at least three characters following "roger." Likewise, "roger_a" would succeed because "_" passes \w{2,3} (specifically \w{3}).
Your request sounded like you wanted more of one of these:
/^roger[0-9a-z]+/i
/^roger[0-9a-z]*/i
that is, "roger" (case insensitive) followed by one or more (+) or zero or more (*) letters and/or numbers.