提取字符串指定的内容
作者:互联网
package com.tszr; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test { public static void main(String[] args) { String str = "[003][002][004][006]"; Pattern pattern = Pattern.compile("(\\d+)"); Matcher matcher = pattern.matcher(str); while (matcher.find()) { System.out.println(matcher.group(1)); } } }
标签:regex,提取,String,matcher,Matcher,指定,Pattern,字符串,java 来源: https://www.cnblogs.com/tszr/p/16320033.html