public static void main(String[] args) { String str = "123我是456张三789的学生"; String regex2 = "\d{1,}"; Pattern p = Pattern.compile(regex2); Matcher matcher = p.matcher(str); while(matcher.find()){ System.out.println(matcher.group()); } }
public static void main(String[] args) { String str = "123我是456张三789的学生"; String regex2 = "\d{1,}"; Pattern p = Pattern.compile(regex2); Matcher matcher = p.matcher(str); while(matcher.find()){ System.out.println(matcher.group()); } }