Extracting an email from a string
Trying to extract an email from a string.
I have tried
publicfinal String rx_email ="[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}";
Pattern pattern = Pattern.compile( rx_email, Pattern.DOTALL );
String sRecptMessage = read();
System.out.println("sRecptMessage: " + sRecptMessage );
Matcher matcher = pattern.matcher( sRecptMessage );
while( matcher.find() ){
String to_email = matcher.group( 1 );
System.out.println("to_email: " + to_email );
}
The code is not matching the email address in the string.
Is this a problem with the reg expression or something else.
Regards

