Possible Duplicate:
What is the best regular expression for validating email addresses?
I am using this particular regular expression for checking emails.
"^[A-Za-z0-9](([a-zA-Z0-9,=\.!\-#|\$%\^&\*\+/\?_`\{\}~]+)*)@(?:[0-9a-zA-Z-]+\.)+[a-zA-Z]{2,9}$"
The issue I have is that, this allows periods before the "@" symbol. Is there any way this expression be modified so that this does not happen, yet all other conditions are maintained.
[email protected] should be invalid
Thanks in advance -Rollin
you could put [^\.]
before the @
so that it will allow any character except the dot
of course this is probably not what you want, so you could just put a []
with any legal characters in it
just in case someone has a email name (i mean the part before the @
) that is just 1 character, you might need to get creative with the |