-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
  • 26,487
  • 10
  • 35
  • 65
B Nagarjuna
  • 23
  • 1
  • 7

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
  • 26,487
  • 10
  • 35
  • 65