<%@page import="java.util.regex.Pattern"%>
<%@page import="java.util.regex.Matcher"%>

public String getPatternMatchReply(String strHTML) {
  String regex = "([\\p{Alnum}]+)://([a-z0-9.\\-&/%=?:@#$(),.+;~\\_]+)";

  Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
  Matcher m = p.matcher(strHTML);
  String s = m.replaceAll("<a style='color: #0000ff;' href='http://$2' target=_blank>http://$2</a>");

  return s;
 }

AND