Regular Expression using apex in Salesforce

String tempStr = 'test.78@gmail.com';

if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', tempStr))

{                         
    //error msg
}

Cheers!!!

No comments:

Post a Comment