java正则表达式匹配

2025-01-20 07:05:17
推荐回答(1个)
回答1:

String regEx = "([\s\S]*?)";String s = "123456789";Pattern pat = Pattern.compile(regEx);Matcher mat = pat.matcher(s);boolean rs = mat.find();for(int i=1;i<=mat.groupCount();i++){  System.out.println(mat.group(i));}