Here you can find the source of isUrl(String s)
public static boolean isUrl(String s)
//package com.java2s; import java.util.regex.Pattern; public class Main { public static final String URL_REG_EXPRESSION = "^(https?://)?([a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+)+(/*[A-Za-z0-9/\\-_&:?\\+=//.%]*)*"; public static boolean isUrl(String s) { if (s == null) { return false; }//from w ww . ja v a 2s .c om return Pattern.matches(URL_REG_EXPRESSION, s); } }