List of utility methods to do Regex URL Validate
boolean | isUri(String input) is Uri try { if (input == null) return false; Matcher matcher = Pattern.compile(URL_PATTERN).matcher(input); return matcher.find(); } catch (Exception e) { return false; |
boolean | isUrl(final String url) is Url Pattern urlPattern; if (url.startsWith("file")) { urlPattern = Pattern.compile(REGEX_FILE, Pattern.CASE_INSENSITIVE); } else { urlPattern = Pattern.compile(REGEX_HTTPS, Pattern.CASE_INSENSITIVE); Matcher matcher = urlPattern.matcher(url); return matcher.find(); ... |
boolean | isUrl(String aUrl) Check if the URL complies with the expected pattern. Matcher matcher = PATTERN_HOST_PART.matcher(aUrl);
return matcher.matches();
|
boolean | isURL(String f) Checks if the string is a URL (not necessarily remote, can be any protocol) return f.startsWith("http:") || f.startsWith("ftp:") || f.startsWith("https:") || URLmatcher.matcher(f).matches(); |
boolean | isUrl(String s) is Url if (isEmpty(s)) return false; boolean ret = Pattern.matches("^(https|http|ftp|rtsp|mms)?:\\/\\/[^\\s]*$", s); if (!ret) ret = Pattern.matches("^[\\.\\/\\?#a-zA-Z0-9-_=&;,%]*$", s); return ret; |
boolean | isUrl(String s) is Url 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(); |
boolean | IsUrl(String str) Is Url Pattern pattern = Pattern.compile("^[\\w]+://[\\w\\-\\.]+"); Matcher matcher = pattern.matcher(str); if (matcher.find()) { return true; return false; |
boolean | isUrl(String test) Checks if given string is uri. final Matcher uriMatcher = URI_PATTERN.matcher(test); return uriMatcher.find(); |
boolean | isUrl(String text) Tests if the given text is url. return IS_URL_TEST.matcher(text).matches();
|
boolean | isURL(String url) is URL return Pattern.matches( "^(https?://(w{3}\\.)?)?\\w+\\.\\w+(\\.[a-zA-Z]+)*(:\\d{1,5})?(/\\w*)*(\\??(.+=.*)?(&.+=.*)?)?$", url); |