1.Java的正則表達式
參考文章:https://www.cnblogs.com/hubingxu/archive/2012/02/17/2355516.html
matcher.find()方法是部分匹配,是查找輸入串中與模式匹配的子串,如果該匹配的串有組還可以使用group()函數。
matches()是全部匹配,是將整個輸入串與模式匹配,如果要驗證一個輸入的數據是否爲數字類型或其他類型,一般要用matches()。
String patternString = "abc";
String input = "abcabc";
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(input);
if (matcher.matches()) {
System.out.println("Match");
int g = matcher.groupCount();
}