public class RegTest {
static void test() {
Pattern p = null;
Matcher m = null;
int a = 0;
p = Pattern.compile("is");
m = p.matcher("what is this?my name is what!");
// b = m.matches();
while (m.find()) {
a++;
}
System.out.println("is 出现了"+a+"次");
}
public static void main(String args[]) {
test();
}
}