public static String urlToUserInfo ( String url ) { String lcUrl = url . toLowerCase ( ) ; if ( lcUrl . startsWith ( DNS_SCHEME ) ) { return null ; } for ( String scheme : ALL_SCHEMES ) { if ( lcUrl . startsWith ( scheme ) ) { int authorityIdx = scheme . length ( ) ; Matcher m = USERINFO_REGEX_SIMPLE . matcher ( lcUrl . substring ( authorityIdx ) ) ; if ( m . find ( ) ) { return m . group ( 1 ) ; } } } return null ; }
Extract userinfo from the absolute URL argument that is username