作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以使用原子分组(或以其他方式)模拟所有格量词(.NET 不支持)?
笔记。我发现 (x+x+)++y
可以换成(?>(x+x+)+)y
,但这只是一个例子,我不知道是否总是{something}@+
等于 (?>{something}@)
(其中 @
是一个量词)。
最佳答案
是的。我可以引用大师本人杰弗里·弗里德尔 (Jeffrey Friedl) 的经典著作 Mastering Regular Expressions (3rd Edition) 第 142 页的内容吗? :
"In one sense, possessive quantifiers are just syntactic sugar, as they can be mimicked with atomic grouping. Something like
.++
has exactly the same result as(?>.+)
, although a smart implementation can optimize possessive quantifiers more than atomic grouping."
关于.net - 模拟所有格量词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5537513/
我试图让用户提交查询“Joe Frankles”、“Joe Frankle”、“Joe Frankle's”以匹配原始文本“Joe Frankle's”。现在我们正在索引这个文本所在的字段(轮胎/ r
我是一名优秀的程序员,十分优秀!