Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex

Status
Not open for further replies.

kyern

Programmer
Mar 30, 2006
36
US
I am trying to find a regex that would allow only the characters allowed in the left half of an email address. It would fail if there was an @ sign or other special character not normally allowed. If anyone can help it would be very appreciated.

Also if anyone knows of a good resource to learn about building regex that would be great.

David
 
Try this
Code:
function alpha_numeric_dash_undrscr() { 
  //Accepts a-z, A-Z, 0-9 - _
  var re = /^[\w\-]+$/;
  return re.test(value);
}

Pass the value in you want to test and it will return true or false.

At my age I still learn something new every day, but I forget two others.
 
Excellent the combination of those worked perfect.

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top