Java Regex URL Validate isUrlWithUserInfo(String str)

Here you can find the source of isUrlWithUserInfo(String str)

Description

str is url with user info

License

Open Source License

Parameter

Parameter Description
str a parameter

Declaration

public static boolean isUrlWithUserInfo(String str) 

Method Source Code

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

import java.util.regex.Pattern;

public class Main {
    static final Pattern URL_WITH_USER_INFO_REGEX = Pattern
            .compile("^\\s*(((\\w+://).+@([\\w\\d\\.]+)(:[\\d]+){0,1}/*(.*))|([^\\s]+@([\\w\\d\\.]+):(.*)))");

    /**/*from w  w  w .  j  a  v a 2s.c  o  m*/
     * str is url with user info
     * @param str
     * @return
     */
    public static boolean isUrlWithUserInfo(String str) {
        return URL_WITH_USER_INFO_REGEX.matcher(str).matches();
    }
}

Related

  1. isUrl(String url)
  2. isURL(String url)
  3. isUrl(String x)
  4. isUrlAddress(String text)
  5. isUrlFile(String filePath)
  6. isUrn(String value)