0

I am interested to know whether the email provided by user is validate or not ? I try to use Pattern and Regex , but these classes are not available in lwuit j2me so how can I valid email in such case?

bharath
  • 14,283
  • 16
  • 57
  • 95
tizbn
  • 1,907
  • 11
  • 16
  • possible duplicate of [Is there email validator code for Java ME or BlackBerry?](http://stackoverflow.com/questions/6923834/is-there-email-validator-code-for-java-me-or-blackberry) – bharath Sep 07 '11 at 09:35

2 Answers2

1

Check if there is exactly one @ symbol, and exactly one . symbol, that . is after the @ at least one letter or number in between, and the length of the trailing part after . is between 2 and 3 letters. Some letters or numbers should be before @.

dhblah
  • 9,751
  • 12
  • 56
  • 92
  • There are email addresses that do not fit that scheme, liketest@info.museum, norbert@[25.125.23.0] – Jens Aug 04 '11 at 08:02
  • thank dear gasan and Jens for reply and I am new this field so could you provide me simple code for this purpose ? – tizbn Aug 04 '11 at 08:41
1

The only way to validate an email address is to send an email and let the user tell you it arrived.

Email addresses can be very very complicated, so no easy check based on the address as a string will be correct in every case. As a sanity check, I'd check if it contains an @ sign, but nothing more.

Jens
  • 25,229
  • 9
  • 75
  • 117