RegExp exp = new RegExp(r"(\w+)");
print(exp.hashCode);
print(exp.isCaseSensitive);
print(exp.isMultiLine);
print(exp.pattern);
print(exp.runtimeType);
RegExp exp = new RegExp(r"(\w+)");
print(exp.allMatches("abc def ghi"));
print(exp.firstMatch(""));
print(exp.hasMatch("as"));
print(exp.matchAsPrefix("ab cd", 3));
print(exp.stringMatch("abc de"));
print(exp.toString());
RegExp postalcode = new RegExp(r‘(\d{6})‘); print(postalcode.hasMatch("518000"));
RegExp mobile = new RegExp(r"(0|86|17951)?(13[0-9]|15[0-35-9]|17[0678]|18[0-9]|14[57])[0-9]{8}"); Iterable<Match> mobiles = mobile.allMatches("13812345678 12345678901 17012345678"); for (Match m in mobiles) { String match = m.group(0); print(match); }
RegExp url = new RegExp(r"^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+"); print(url.firstMatch("http://www.google.com"));
RegExp identity = new RegExp(r"\d{17}[\d|x]|\d{15}"); print(identity.stringMatch("My id number is 35082419931023527x"));
原文:https://www.cnblogs.com/lxlx1798/p/11371012.html