Java Utililty Methods Regex URL Validate

List of utility methods to do Regex URL Validate

Description

The list of methods to do Regex URL Validate are organized into topic(s).

Method

booleanisUri(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;
booleanisUrl(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();
...
booleanisUrl(String aUrl)
Check if the URL complies with the expected pattern.
Matcher matcher = PATTERN_HOST_PART.matcher(aUrl);
return matcher.matches();
booleanisURL(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();
booleanisUrl(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;
booleanisUrl(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();
booleanIsUrl(String str)
Is Url
Pattern pattern = Pattern.compile("^[\\w]+://[\\w\\-\\.]+");
Matcher matcher = pattern.matcher(str);
if (matcher.find()) {
    return true;
return false;
booleanisUrl(String test)
Checks if given string is uri.
final Matcher uriMatcher = URI_PATTERN.matcher(test);
return uriMatcher.find();
booleanisUrl(String text)
Tests if the given text is url.
return IS_URL_TEST.matcher(text).matches();
booleanisURL(String url)
is URL
return Pattern.matches(
        "^(https?://(w{3}\\.)?)?\\w+\\.\\w+(\\.[a-zA-Z]+)*(:\\d{1,5})?(/\\w*)*(\\??(.+=.*)?(&.+=.*)?)?$",
        url);