需求1:将字符串"2j0a2v0a",中的字母打印出来
public static void main(String[] args) {
String str="2j0a2v0a";
String regex="[a-z]{1}";
Pattern pattern=Pattern.compile(regex);
Matcher matcher=pattern.matcher(str);
while(matcher.find()) {
System.out.println(matcher.group());
}
}
网友评论