Regex
Can somebody help me in making me understand the regex function-
What these characters means
/^(\w+[\-\.])*\w+@(\w+\.)+[A-Za-z]+$/
function validate(input)
{
var email =/^(\w+[\-\.])*\w+@(\w+\.)+[A-Za-z]+$/;
if(email.test(input))
{
return true;
}
else
{
alert('invalid email id');
return false;
}
}
mansi sharma
Junior Poster in Training
75 posts since Apr 2008
Reputation Points: 17
Solved Threads: 0
\w means a word character
+ means one or more
\- means dash
\. means .
* means zero or more
it represents a simple check to see if the email address is valid
pritaeas
Posting Expert
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875