Java正则匹配 以某个汉字开头和结束
public static void main(String[] args) {
String str = "正则匹配测试";
//以正开头试结尾匹配
if (str.matches("(?:正).*") && str.matches(".*(?:试)")) {
System.out.println(str);
}
//或者
if (str.matches("(?:正).*(?:试)")) {
System.out.println(str);
}
}