- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在阅读 PCRE 文档,它指的是所有格量词,但没有明确或具体地定义它们。我知道什么是贪婪量词,我知道什么是惰性量词。但占有欲?
PCRE man page当它使用该术语而不定义它时,似乎是在作弊。手册页特别指出,所有格量词一词最初是在 Friedl's book 中定义的。 .好吧,那太好了,但我没有 Friedl 的书,在阅读手册页时,在字里行间,我无法弄清楚是什么将所有格量词与贪婪量词区分开来。
最佳答案
也许最好的起点是 Regex Tutorial - Possessive Quantifiers :
When discussing the repetition operators or quantifiers, I explained the difference between greedy and lazy repetition. Greediness and laziness determine the order in which the regex engine tries the possible permutations of the regex pattern. A greedy quantifier will first try to repeat the token as many times as possible, and gradually give up matches as the engine backtracks to find an overall match. A lazy quantifier will first repeat the token as few times as required, and gradually expand the match as the engine backtracks through the regex to find an overall match.
Possessive quantifiers are a way to prevent the regex engine from trying all permutations. This is primarily useful for performance reasons. You can also use possessive quantifiers to eliminate certain matches.
关于regex - 有人可以向我解释占有量词吗? (常用表达),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1117467/
我是一名优秀的程序员,十分优秀!