java正则查找字符串 java怎么利用正则表达式,提取字符串?

java怎么利用正则表达式,提取字符串?String testString = "java怎么利用正则表达式从给定的字符串中取出匹配规则字符串"Pattern pattern = Pattern.co

java怎么利用正则表达式,提取字符串?

String testString = "java怎么利用正则表达式从给定的字符串中取出匹配规则字符串"

Pattern pattern = Pattern.compile("w ")

Matcher matcher = pattern.matcher(testString)

while(matcher.find())

{

System.out.println(matcher.group())

}