Pages

Thursday, March 31, 2011

Regular Expression for Email Validation

^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$

Email validation. With this short expression you can validate for proper email format. It’s short and accurate.

^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$

Much simpler email expression. This one forces a length of 2 or 3, which fits current specs, but you may need to alter the end as this one allows all numerals on the .COM section.

No comments:

Post a Comment