展开全部
matcher0对象在调用matches()后修改了这个62616964757a686964616fe78988e69d8331333337383831对象的某个全局变量.
在match()方法中有this.oldLast = this.last;等代码, 而find()中则没有.
这个就是match()和find()方法的区别import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* mathch()和find()方法的区别
* @author Administrator
*
*/
public class TestReg{
public static void main(String[] args) {
Pattern p = Pattern.compile("^[0-5]*$");
Matcher mach = p.matcher("2131232131");
if(mach.find()){
System.out.println("fin(): " + mach.group());
}else{
System.out.println("none find");
}
System.out.println("*************************");
if(mach.matches()){
System.out.println("match(): " + mach.group());
}else{
System.out.println("none matched");
}
}
}