0

I like to check this email address with JavaScript and regex.

Because of quotes and other signs there will be a syntax error. I checked with Firebug.

Now, can anyone send me a possible solution to check this with JavaScript.

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|
"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09
\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-
z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]
[0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z
0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09
\x0b\x0c\x0e-\x7f])+)\])
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Marc
  • 2,659
  • 3
  • 34
  • 41
  • 4
    Do not do that and see http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses – kmkaplan Nov 05 '09 at 11:26
  • Is there an email regex that's not very strict but filters out obvious errors, like entering a telephone number in an email field? – Andomar Nov 05 '09 at 11:36
  • Andomar: ".@." i.e. check for the presence of a “@” and the presence of a character before and after it. – kmkaplan Nov 05 '09 at 12:54
  • I tried to make it a long time ago, following all the standards. Then I realized it's not an easy task. After all, a lot of web services CAN'T work with ALL VALID email addresses (I actually never found any) so creating perfect validator seems to have no purpose in real environment. Bottom of line, there's always ONE MORE address to fail for some reason (multiple @s, escape-characters, non-english letters, etc). ex. `abc\@@domain.com`, `abc"abc@xyz.com"xyz@xzy.com`... – Wh1T3h4Ck5 Nov 15 '12 at 09:15

1 Answers1

0

jQuery email validation

Phill Pafford
  • 83,471
  • 91
  • 263
  • 383