Friday, 11 September 2015

How to Check email address is valid in apex


if(!Pattern.matches('([a-zA-Z0-9_\\-\\.]+)@((\\[a-z]{1,3}\\.[a-z]{1,3}\\.[a-z]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})', tempStr))
{  
//not valid email address                     
   return true;
}

https://help.salesforce.com/apex/HTViewSolution?id=000170904&language=en_US

No comments:

Post a Comment