Here you can find the source of isUrl(String s)
private static boolean isUrl(String s)
//package com.java2s; //License from project: Apache License import java.net.MalformedURLException; import java.net.URL; import java.util.regex.Pattern; public class Main { protected static Pattern scheme = Pattern .compile("^[a-zA-Z][A-Za-z0-9+.-]*:\\/\\/"); private static boolean isUrl(String s) { s = s.trim();//Trim whitespace boolean missingScheme = false; if (!scheme.matcher(s).find()) { //No scheme specified. //if (s.indexOf('\\') > -1) return false; //It means we have a windows path. //s = "http://" + s; //missingScheme = true; return false; //Don't try to help. If they forgot the http://, consider it a program }/*w ww .j ava 2s . c o m*/ try { URL u = new URL(s); //if (missingScheme && !TokenUtils.fastMatches(regex, u.getHost())) return true; } catch (MalformedURLException e) { return false; } } }