java正则表达式String.matches有BUG!

string.matches("(. ¦\s)*?测 试(. ¦\s)*?");
如果匹配的话,马上就有结果返回,反之,就死在那!
string.indexof("测 试")> =0是不会有问题的 .

正则表达式在java中需要编译运行
Pattern search = Pattern.compile("ab");
Matcher from = p.matcher("aaaaab");
boolean b = Pattern.matches(search, from);

string.matches写法是错误的
温馨提示:答案为网友推荐,仅供参考
相似回答