연속된 문자열 검증 regex

archymi·2022년 4월 12일
0
String p3 = "(\\w)\\1\\1"; // 3자리의 연속된 문자열 검증
String p4 = "(\\w)\\1\\1\\1"; // 4자리의 연속된 문자열 검증
String p5 = "(\\w)\\1\\1\\1\\1"; // 5자리의 연속된 문자열 검증
if (characterCount == 3) {
	if (Pattern.compile(p3).matcher(newPassword).find()) {
		System.out.println("true");
	} else {
		System.out.println("false");
	}
}

0개의 댓글