Skip to content

Instantly share code, notes, and snippets.

@brownsoo
Last active February 3, 2017 02:25
Show Gist options
  • Save brownsoo/476dd4174ce3a65adc3080ae63cd303f to your computer and use it in GitHub Desktop.
Save brownsoo/476dd4174ce3a65adc3080ae63cd303f to your computer and use it in GitHub Desktop.
Regular expression to check if the string contains only number and char.
// 문자열이 문자와 숫자로만 되어 있는지 확인
public static boolean checkNumberCharMixed(@NonNull String password) {
Pattern p = Pattern.compile("^([0-9]+[a-zA-Z]+|[a-zA-Z]+[0-9]+)[0-9a-zA-Z]*$");
return p.matcher(password).matches();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment