System.out.println("&".matches("[a-z&&[efg]]"));System.out.println("&".matches("[a-z&[efg]]"));System.out.println("+".matches("[a-z++[efg]]"));System.out.println("+".matches("[a-z+[efg]]"));输出结果依次是:false, true, true, true谁能告诉我为什么这样啊
调试欢乐多
java.regex.pattern
应该是这个
System.out.println("&".matches("[a-z&&[efg]]"));//false
System.out.println("&".matches("[a-z&[efg]]"));//true
"&".matches("[a-z&&[efg]]"),&&在这个里面是交集的意思,所以为false
"e".matches("[a-z&&[efg]]"),这样就为true了