0

I have this regex in JavaScript:

new RegExp('^[0-9a-z._-]+@{1}[0-9a-z.-]{2,}[.]{1}[a-z]{2,}$','i');

and I want to modify it.

The last part of the mail must have a minimum value: 2 chars and no maximum length so I can put mails such as .localhost .paris .thisismyexample ...

How may I do that?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880

1 Answers1

0
new RegExp('\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,}\b','i');
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268