java正则表达式匹配真实姓名(2~7个中文或者3~10个英文)

2024-12-25 17:24:37
推荐回答(1个)
回答1:

public static void main(String[] args) {
String regx = "(([\u4E00-\u9FA5]{2,7})|([a-zA-Z]{3,10}))";
System.out.println(Pattern.matches(regx, "我我我我我我我"));
System.out.println(Pattern.matches(regx, "aBcDefghij"));

}