Android examples for Network:URL
get Url String In String by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String getUrlStrInString(String origin) { if (origin == null) { throw new NullPointerException("the param origin is null"); }//from ww w. java 2 s . c om Pattern pattern = Pattern .compile("(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?"); Matcher matcher = pattern.matcher(origin); StringBuffer buffer = new StringBuffer(); //while if (matcher.find()) { buffer.append(matcher.group()); } return buffer.toString(); } }