-1

I do have this regex that validates email addresses: ^\w+(\.\w+)*@(\w+\.)+\w{2,4}$

What I need is to append this current regex that will invalidate email addresses starting with none@ OR na@

How to? Thanks!

kkshinichi
  • 63
  • 1
  • 2
  • 10
  • 1
    Note that your regex does not validate all valid email addresses, and rejects many valid addressses. There's more information in the answers to [How to validate an email address using a regular expression?](https://stackoverflow.com/a/201378/43452) – Stobor Jul 23 '18 at 04:13
  • You may need to use grouping on the local part (the part before @) – Ṃųỻịgǻňạcểơửṩ Jul 23 '18 at 04:21

1 Answers1

2

Add negative lookahead to the beginning of the pattern:

^(?!none@|na@)\w+(\.\w+)*@(\w+\.)+\w{2,4}$

https://regex101.com/r/vf4WqT/1

CertainPerformance
  • 356,069
  • 52
  • 309
  • 320