-1

Possible Duplicate:
What is the best regular expression for validating email addresses?

I have the following expression

**replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
   replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');** 

but it doesn't validate email if the email in this form a.b@alexmed.com it only validate email in form a@alexmed.com

i need another expression to validate the form a.b@alexmed.com

Community
  • 1
  • 1

1 Answers1

0

I think \w+ is the same as [a-zA-Z0-9], so it doesn't like the dot. I'm not good at this, but try

**replacePattern3 = /(\[a-zA-Z0-9\.]+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;

You also might want to add a few more symbols to most places, because domain names can have numbers and certain symbols in them.

Koeneuze
  • 477
  • 2
  • 7
  • 9