How would I make a basic Java E-mail validation please?
I have a basic Java program (in BlueJ) which accepts an E-mail address field from the user - in the constructor how would I make a basic E-mail validation just to ensure it has the correct @ and '.' within the address please?
I have done a little bit of research on the Internet and found people recommend using regular expressions but I do not really understand.
Any help would be very much appreciated - thank you in advance :-)
You could use regular expressions for that. They are part of the String.matches(String regex) method. This method is called on the email addres, the regex will have to be one which checks for the right syntax. You can find out more about these regular expressions through the following link:
There's even an example of email validation there.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center