View Full Version : Regular Expression Help

04-17-2009, 06:41 AM
I have this regular expression to test for an email:

/^[a-zA-Z0-9\- ]+\@[a-zA-Z0-9 \-\.]+\.([a-zA-Z]{2,3})$/;

It works all good except that if I put an email like:


It will say its valid even though there are two '.'

Any idea how I could fix this?

04-17-2009, 07:29 AM
Try using this, I got it from one of the Dynamic Drive functions. I've tested it against your example and it doesn't allow the double "."

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i