code: public static MaskedText maskInUrl(String url){
  		MaskedText result = new MaskedText();
  		result.setClearText(url);
  		result.setText(url);
  		result.setMasked(null);
  		
  		if (url != null){
  			Matcher urlMatcher = URL_PATTERN.matcher(url);
  			if (urlMatcher.find()) {
  				Matcher pwdMatcher = PASSWORD_IN_URL_PATTERN.matcher(url);
  				if (pwdMatcher.find()){
  					result.setText(pwdMatcher.replaceFirst(PASSWORD_IN_URL_MASK));
  					String s = pwdMatcher.group();  // with leading ":" and trailing "@"
  					result.setMasked(s.substring(1, s.length()-1));
  				}
  			}
  		}
  		return result;
  	}
docs: Mask password in URL.
  
  @param url  The original URL string.
  @return		The result containing original URL, masked URL and the password which had been masked.
  If there is no password filed found in the URL, in the result, original and masked URL
  will be the same, and password will be null.