I am new to Java, please can someone confirm that the following would work:
//Start of Java
/*
* Checks for invalid characters
* in email addresses
*/
public class EmailValidation {
public static boolean isEmailValid(String email){
boolean retval=false;
String emailPattern = "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$";
retval= email.matches(emailPattern);
}
//End of Java
This would be really appreciated... I am going to be calling this in some XML and if an incorrect email has been entered, a statement from the xml will appear to the user.
thanks
Pip
//Start of Java
/*
* Checks for invalid characters
* in email addresses
*/
public class EmailValidation {
public static boolean isEmailValid(String email){
boolean retval=false;
String emailPattern = "^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$";
retval= email.matches(emailPattern);
}
//End of Java
This would be really appreciated... I am going to be calling this in some XML and if an incorrect email has been entered, a statement from the xml will appear to the user.
thanks
Pip