正则表达式 Posted on 2021-02-16 | Edited on 2021-02-24 | In java系列 123456789101112131415161718/** * @author devin * @version 1.0.2 * @date 2021-02-16 23:23 */public class Zhenze { // 待匹配字符串 public static void main(String[] args) { String str = "湖北省武汉市1573rr4562"; Pattern p = Pattern.compile("[1-9]+"); Matcher m = p.matcher(str); while(m.find()){ System.out.println(m.group()); } }} Donate comment here Donate WeChat Pay