Android examples for java.util.regex:Character Pattern
match URL by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**// w ww . j a va2 s .c o m * url */ private static final String V_URL = "^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$"; public static boolean Url(String value) { return match(V_URL, value); } private static boolean match(String regex, String str) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); return matcher.matches(); } }