String strMail = 'testmail@gmail.com'; if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', strMail)) { //Your error message }
String strMail = 'testmail@gmail.com'; if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', strMail)) { //Your error message }