1

what regular expressions are used for email validation can you help me out

$("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" })

3 Answers3

1

You should try this...

/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/
Query Master
  • 6,989
  • 5
  • 35
  • 58
  • 1
    Just be prepared to handle complaints from people whose email address is valid according to the standard but invalid according to this regex. – nnnnnn Mar 01 '12 at 06:41
  • @query master That regex would validate an email like xyz@.co.og as true. Can we have a period after @? Also og is not a valid domain which would be validated true – akhil Aug 14 '15 at 21:42
0

This regex would work.

^([a-zA-Z])([\w-.]*)@([\w]+)([\w-.])*\.(aero|asia|be|biz|com.ar|ca|co|co.in|co.jp|co.kr|co.sg|com|com.ar|com.mx|com.sg|com.ph|co.uk|coop|de|edu|es|fr|gov|in|info|it|jobs|ltd|mil|mobi|museum|name|net|net.mx|org|ru|us)+$

Subash
  • 7,098
  • 7
  • 44
  • 70
akhil
  • 1
  • 1
0
function validateEmail(email) { 
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\
".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA
-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(email);
} 

Validate email address in JavaScript?

Community
  • 1
  • 1
Kanishka Panamaldeniya
  • 17,302
  • 31
  • 123
  • 193