-5

For email address I am using regex as

var emailRegex = /^([\w-.]+@([\w-]+.)+[\w-]{2,4})?$/

What is regex for

LastName FirstName <lastName.firstName@gmail.com>
user1120418
  • 261
  • 3
  • 8
  • 18
  • there isn't any perfect regex for an email ID. – Rahul Oct 14 '14 at 10:04
  • Same as [Lname FName](http://stackoverflow.com/questions/26299372/regex-expression-for-email-address) which in also seems to be duplicate [Regex for email](http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address) – Shubh Oct 14 '14 at 10:12
  • Check out the regexp used to validate email addresses according to the RFC 822 grammar: [Don't actually use this](http://code.iamcal.com/php/rfc822/full_regexp.txt) – Kieran Bristow Oct 14 '14 at 10:15

1 Answers1

0

Use backrefs:

/^([\w-.]+) ([\w-.]+) (\1\.\2@([\w-]+.)+[\w-]{2,4})?$/
simonzack
  • 19,729
  • 13
  • 73
  • 118