Java Regex URL Validate isUrl(String s)

Here you can find the source of isUrl(String s)

Description

is Url

License

Open Source License

Declaration

public static boolean isUrl(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isUrl(String s) {
        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();
    }/*from   w ww .j  ava2  s  .c o m*/
}

Related

  1. isUri(String input)
  2. isUrl(final String url)
  3. isUrl(String aUrl)
  4. isURL(String f)
  5. isUrl(String s)
  6. IsUrl(String str)
  7. isUrl(String test)
  8. isUrl(String text)
  9. isURL(String url)