public class Pattern2 {标签:String,Pattern,System,2071357078,println,out From: https://www.cnblogs.com/wxyhh/p/17438872.html
public static void main(String[] args) {
//1--创建对象
Pattern p=Pattern.compile("\\d+");//
String[] str=p.split("我的qq邮箱是:[email protected]我的电话是:19518135682我的QQ号是:2071357078");
System.out.println("是否匹配Pattern的输入模式"+Pattern.matches("\\d+","2223aa"));
Matcher m=p.matcher("22bb23");//??
System.out.println("返回该Mather对象是由哪个Pattern对象创建的,即p为:"+m.pattern());
System.out.println("将给定的字符串分割成Pattern模式匹配为:");
for(int i=0;i<str.length;i++){
System.out.println(str[i]+"");
}
}
}