public static void getDemo(){
String str = "ming tian jiu yao fang jia le, da jia";
String regex = "\\b[a-z]{3}\\b";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
可以看下JDK帮助文档:
matches() :Attempts to match the entire region against the pattern.
find():Attempts to find the next subsequence of the input sequence that matches the pattern.