0

I have a regex but after the dot you can fill in just 1 letter... i want to type atleast 2 letters like test@test.com or test@test.fr but not test@test.d

/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/

What is wrong?

Cœur
  • 37,241
  • 25
  • 195
  • 267
151RUM
  • 75
  • 1
  • 1
  • 8
  • Well, my regex is ok besides the fact that he accepts .f instead of .fr - can you help me out maybe ? I cant find the right piece of code to get it working... – 151RUM Jul 13 '16 at 13:38

1 Answers1

0

{n, m} in regular expressions can be used. Following explains how this works:

Where n and m are positive integers and n <= m. Matches at least n and at most m occurrences of the preceding expression. When m is omitted, it's treated as ∞.

So in your case, you could use it as {2}

Aditya Gupta
  • 633
  • 1
  • 4
  • 11