正则表达式 – 如何匹配小于或等于100的数字?
发布时间:2020-12-14 06:28:16 所属栏目:百科 来源:网络整理
导读:嗨,我想匹配小于或等于100的数字,它可以是0-100之内的任何值,但正则表达式不应匹配大于100的数字,如120 130,150,999等. 尝试这个 b(0*(?:[1-9][0-9]?|100))b 说明 "b # Assert position at a word boundary( # Match the regular expression below and ca
嗨,我想匹配小于或等于100的数字,它可以是0-100之内的任何值,但正则表达式不应匹配大于100的数字,如120 130,150,999等.
尝试这个
b(0*(?:[1-9][0-9]?|100))b 说明 " b # Assert position at a word boundary ( # Match the regular expression below and capture its match into backreference number 1 0 # Match the character “0” literally * # Between zero and unlimited times,as many times as possible,giving back as needed (greedy) (?: # Match the regular expression below # Match either the regular expression below (attempting the next alternative only if this one fails) [1-9] # Match a single character in the range between “1” and “9” [0-9] # Match a single character in the range between “0” and “9” ? # Between zero and one times,giving back as needed (greedy) | # Or match regular expression number 2 below (the entire group fails if this one fails to match) 100 # Match the characters “100” literally ) ) b # Assert position at a word boundary " 访问here以备将来出现问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ruby-on-rails – 如何在Heroku上实现带有Rails 3.2.2的SPD
- ruby-on-rails – Factory Girl与现有对象创建关联
- ruby-on-rails – 在Rails中跟踪用户的点击次数和页面访问次
- quick-cocos2d-x 加密全过程解析
- 技术公益实践者德歌:将PostgreSQL的种子播至四海八荒
- 广告聚合:KeyMob移动广告聚合平台的特色功能简介,KeyMob特
- 四种生成和解析XML文档的方法详解(介绍+优缺点比较+示例)
- ruby-on-rails – 带有json返回的form_for
- VB6学习技巧
- AJAX 跨域请求 - JSONP获取JSON数据