日期:2014-05-19 浏览次数:20655 次
public static void main(String[] args) { String formula = "XXXX${date}V${demo}VVV"; String reg = "\\$\\{([^}]+)\\}"; Pattern p = Pattern.compile(reg); Matcher matcher = p.matcher(formula); while (matcher.find()) { System.out.println(matcher.group() + " " + matcher.group(1)); } }