유니코드 인식 대소문자 접기를 활성화합니다.
이것을 CASE_INSENSITIVE 플래그와 함께 compile() 메서드에 대한 플래그 값으로 사용하고 정규식을 사용하여 유니코드 문자를 검색하면 두 경우 모두 유니코드 문자가 일치합니다.
예시
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UNICODE_CASE_Example {
public static void main( String args[] ) {
String regex = "\u00de";
//Compiling the regular expression
Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE|Pattern.CASE_INSENSITIVE);
//Retrieving the matcher object
String str[] = {"\u00de", "\u00fe", "\u00ee", "\u00ce"};
for (String ele : str) {
Matcher matcher = pattern.matcher(ele);
if(matcher.matches()) {
System.out.println(ele+" is a match for "+regex);
} else {
System.out.println(ele+" is not a match for "+regex);
}
}
}
} 출력
Þ is a match for Þ þ is a match for Þ î is not a match for Þ Î is not a match for Þ