java正则匹配并提取字串
Pattern p = Pattern.compile("\\(.*\\)"); Matcher m = p.matcher("1.2.0(23)"); if(m.find()){ System.out.println(StringUtils.substring("1.2.0(23)", m.start(), m.end())); }
输出结果:23
Pattern p = Pattern.compile("\\(.*\\)"); Matcher m = p.matcher("1.2.0(23)"); if(m.find()){ System.out.println(StringUtils.substring("1.2.0(23)", m.start(), m.end())); }
输出结果:23