import java.util.regex.*; // Make regex classes easily available Pattern r = Pattern.compile( "\\b \n"+ "# Capture the address to $1 . . . \n"+ "(\n"+ " \\w[-.\\w]* # username\n"+ " @\n"+ " [-\\w]+(\\.[-\\w]+)*\\.(com|edu|info) # hostname\n"+ ")\n"+ "\\b\n", Pattern.CASE_INSENSITIVE|Pattern.COMMENTS); Matcher m = r.matcher(text); text = m.replaceAll("$1"); ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl