Your code fragment also appears to want to downshift upper-case to lower-case. Is this also a requirement?
If you're trying to verify that a tainted input is of a correct form, you might want to consider providing the user with an appropriate error message for malformed input. See this recent reply to a very similar question, which focuses on providing the user with a reasonable description of what they did wrong.
In reply to Re: a terribly basic question showing my inept skills with regular expressions
by dws
in thread a terribly basic question showing my inept skills with regular expressions
by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |