Here you can find the source of findUrl(StringBuilder sb)
public static final StringBuffer findUrl(StringBuilder sb)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static final StringBuffer findUrl(StringBuilder sb) { Pattern pattern = Pattern .compile("(http://|https://){1}[\\w\\.\\-/:]+"); Matcher matcher = pattern.matcher(sb); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { String s = matcher.group(1); matcher.appendReplacement(buffer, "<a href=\"" + s + "\">" + s + "</a>"); }//www. ja v a 2 s.c om matcher.appendTail(buffer); return buffer; } }