日期:2014-05-20 浏览次数:20697 次
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FindGroup {
private static int count;
public static void main(String[] args){
Matcher m = Pattern.compile("\\w+").matcher("Java isn't easy!");
//Matcher m = Pattern.compile("\\w+").matcher("Java is very easy!");
while(m.find()){
count++;
System.out.println(m.group());
}
System.out.println(count);
}
}