输入线在下面
Item(s): [item1.test],[item2.qa],[item3.production]
你能帮我写一个Java正则表达式来提取
item1.test,item2.qa,item3.production
从上方输入线?
更加简洁:
String in = "Item(s): [item1.test],[item2.qa],[item3.production]"; Pattern p = Pattern.compile("\\[(.*?)\\]"); Matcher m = p.matcher(in); while(m.find()) { System.out.println(m.group(1)); }