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;
}
}

\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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.