-
-
Save digvijaybhakuni/35ec9ced226fc5e265c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
/** | |
* Give true is all condition matches, otherwise false. | |
* @param String | |
* @return boolean | |
*/ | |
private boolean validateUserName(String username){ | |
Pattern pattern = Pattern.compile("^[a-z0-9_-]{3,15}$"); | |
Matcher matcher = pattern.matcher(username); | |
return matcher.matches(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment