====== 문자열의 링크를 찾아서 a 태그로 감싸주기 ====== * http://www.java2go.net/java/java_regex.html 를 참조한다. public static String populateLinks(String str) { Matcher matcher = Pattern.compile("(https?|ftp)://[\\S]+").matcher(str); StringBuffer sb = new StringBuffer(); while(matcher.find()) { String link = matcher.group(); link = link.replaceAll("\\\\", "\\\\\\\\").replaceAll("\\$", "\\\\\\$"); matcher.appendReplacement(sb, String.format("%s", link,link)); } matcher.appendTail(sb); return sb.toString(); }