PDA

View Full Version : Javascript e-mail validation



zoobave
September 21st, 2008, 04:51 PM
When i search js code for a email validation, i found the following pattern is used to validate the given email address using "test()" method. Can anybody explain me the following code?

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

jespdj
September 21st, 2008, 07:38 PM
It's a regular expression. See Regular expressions in JavaScript (http://www.devarticles.com/c/a/JavaScript/Regular-expressions-in-JavaScript/), or Google for it to find more information.