String s = "1.01";
Matcher matcher = Pattern.compile("[+-/\\*\\^\\%]").matcher(s);
if (matcher.find()) {
System.out.println(matcher.group());
}
Run Code Online (Sandbox Code Playgroud)
输入字符串为"1.01",输出为".".我无法理解为什么matcher.find()返回true,输入字符串中没有"+"," - ","*","^","%"等符号.为什么会这样?