Android examples for java.util.regex:URL Pattern
is string a Http Url using regular expression
import android.util.Log; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isHttpUrl(String input) { //if (!isNullOrEmpty(input)) { String regexExpression = "http://([\\w\\WW-]+\\.)+[\\w\\W-]+(/[\\w\\W- ./?%&=]*)?"; if (input.matches(regexExpression)) { return true; }//from ww w . j av a 2 s. c o m //} return false; } }