954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You