Regular Expression using apex in Salesforce
Sample Code: String tempStr = 'test.78@gmail.com'; if ( Pattern.matches( '[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', tempStr ) ) { System.debug( 'Regex Matched' ); } else { System.debug( 'Regex Pattern not Matched' ); } Output: