Java正则表达式

java代码:

import java.util.regex.Matcher;
import java.util.regex.Pattern;
// ……

Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);

while(matcher.find()) {
  System.out.println(matcher.group());
}

参考:http://www.runoob.com/java/java-regular-expressions.html

你可能感兴趣的:(Java正则表达式)