首页 > 学院 > 开发设计 > 正文

java正则表达式匹配字符

2019-11-14 15:06:30
字体:
来源:转载
供稿:网友

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

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

  //后续操作……

}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表