String (@NotNull String message) { Pattern linkPattern = Pattern.compile("http://[a-zA-Z\\d./\\-+]+"); StringBuffer result = new StringBuffer(); Matcher m = linkPattern.matcher(message); while (m.find()) { m.appendReplacement(result, "<a href=\"" + m.group() + "\">" + m.group() + "</a>"); } m.appendTail(result); return result.toString(); }