java正则表达式匹配字符

假设要匹配${2}中间为数字的这个类型的变量String,则

Pattern p = Pattern.compile("\$\{\d+\}");
Matcher m = p.matcher(String);
boolean b = m.find();
while (b) {

  //后续操作……

}

原文地址:https://www.cnblogs.com/xiufengd/p/4961368.html