Created
February 3, 2017 02:27
-
-
Save brownsoo/adc474fb45fbbc5ee774a87571072f8c to your computer and use it in GitHub Desktop.
Regular expression to check if the same char is repeated.
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
// 문자열에 반복되는 문자가 있는지 확인 | |
public static boolean checkSameCharRepeated(@NonNull String password, int repeatLength) { | |
if (repeatLength <= 1) return false; | |
Pattern p = Pattern.compile(".*([a-zA-Z0-9])\\1{"+ (repeatLength - 1) +",}.*"); | |
return p.matcher(password).matches(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment