0

I need help with validating a simple e-mail address, like basic pretty much. In the end after the . it should only contain either 2 or 3 characters or it gives the user an invalid message, however mine isn't recognizing that.

Pattern chckEmail = Pattern.compile("([a-zA-Z0-9]+|[a-zA-Z0-9]+\\.[a-zA-Z0-9]+)*@[a-zA-Z]+(\\.[a-zA-Z]{2,3})");
user3772253
  • 53
  • 1
  • 6
  • 1
    If you're only referring to the TLD, then it's possible to have more than three characters as a TLD (the part at the end after the '.'). You may have to deal with [Punycode.](http://en.wikipedia.org/wiki/Punycode) – markspace Jul 11 '14 at 02:59
  • I understand that, but the professor said the period (.) should be followed by either 2 or 3 characters. Ideally the {2,3} should work, so I thought. – user3772253 Jul 11 '14 at 03:23

0 Answers0