Here you can find the source of isUrl(String s)
public static boolean isUrl(String s)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isUrl(String s) { String url_regex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"; Pattern p = Pattern.compile(url_regex); Matcher m = p.matcher(s); return m.find(); }/*from w ww .j ava2 s .c o m*/ }