-5

How do I validate the following emails with a regular expression?

Input

nagarjuna.nag@vm.com
nagarjuna12.nag@vm.com
nagarjuna12.nag.some@vm.com

Attempt

/^([a-zA-Z0-9.]+)$/
Emma
  • 27,428
  • 11
  • 44
  • 69
B Nagarjuna
  • 33
  • 2
  • 9
  • 1
    I have tried using pattern /^([a-zA-Z0-9.]+)$/ .But it is not working – B Nagarjuna Jun 06 '19 at 07:05
  • if your requirement is to validate email addresses using regex, check [this](https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript) – Matt.G Jun 06 '19 at 12:59

1 Answers1

0

I'm guessing that here we wish to validate these emails, for which we can use an expression similar to:

^([a-z0-9]+((?=\..+@.+\..+)[a-z0-9.]*@[a-z0-9]*\.[a-z0-9]*))$

with an i flag and we can allow more chars, if we like so.

Demo

RegEx Circuit

jex.im visualizes regular expressions:

enter image description here

Community
  • 1
  • 1
Emma
  • 27,428
  • 11
  • 44
  • 69