java正则表达式(基本语法)
Public class cla001{
public int countCode(String a){
//表达式(找出"conxe"中的字符,其中'x'为任意字符)
String b= "co(.)e";
//表达式写入匹配器
Pattern p = Pattern.compile(b);
//匹配
Matcher m = p.matcher(a);
/**
*使用
*//
int num = 0;
//while循环找到就加1
while(m.find()){
num++;
}
//返回结果
return num;
}
}
}