1

I am using validate.js to validate the contact form.

It works fine but issue is email validation seems broken at some intervals

For eg: if email is abc@xyz , then it considers email valid but if email is abc@xyz. , then it considers email invalid

Can't it be like, i.e only consider email valid when abc@xyz.lkj

Following is the regular expression being used

 /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value )

I have no idea about regular expressions. Please help.

Thanks

user3848698
  • 322
  • 4
  • 21
  • Possible duplicate of [Validate email address in JavaScript?](http://stackoverflow.com/questions/46155/validate-email-address-in-javascript) – HamZa Jan 11 '16 at 12:38
  • Also if you're using html 5, you might use `` – HamZa Jan 11 '16 at 12:38

1 Answers1

1

Use this: /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
sonsha
  • 165
  • 2
  • 9