java中的matches方法
包中的String类,包中的Pattern,Matcher类中都有matches()方法。
都与正则表达式有关。下面我分别举例:(字符串:"abc",正则表达式: "[a-z]{3}")
String类的方法:
boolean b = "abc".matches("[a-z]{3}"
(b);
Pattern类中的方法:
boolean b = ("[a-z]{3}","abc");
(b);
Matcher类中的方法:
Pattern p = ("[a-z]{3}");
Matcher m = ("acc");
boolean b =()
(b);
得到的结果都为true。