`

Java正则表达式笔记

    博客分类:
  • Java
 
阅读更多
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
	String u = matcher.group(1);
}
Pattern pattern2 = Pattern.compile(regex, Pattern.DOTALL)//点(.)匹配所有(包括换行)
Matcher matches2 = pattern.matcher(content);
//也可使用以下方式
Pattern pattern3 = Pattern.compile("(?s)" + regex)//点(.)匹配所有(包括换行)
Matcher matches3 = pattern.matcher(content);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics