'\w' allows the non-alpha character '_' (which is considered by Perl to be a "word" character). It also allows for a trailing '\n' in the string (the \n isn't "matched", but it's permitted by '$'). Since I understood the OP's criteria to not permit any sort of space or special character, the solution is to use '\z' instead of '$'.
Update: As pointed out by Roy Johnson, \w also matches numeric digits, so the use of \d is redundant.
Dave
In reply to Re^2: Regular Expression - Need HElp..pls
by davido
in thread Regular Expression - Need HElp..pls
by dani_cv_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |