“贪婪”和“不情愿”正则表达式量词有什么区别?
来自 Pattern
javadocs:
Greedy quantifiers: X? X, once or not at all X* X, zero or more times X+ X, one or more times X{n} X, exactly n times X{n,} X, at least n times X{n,m} X, at least n but not more than m times Reluctant quantifiers: X?? X, once or not at all X*? X, zero or more times X+? X, one or more times X{n}? X, exactly n times X{n,}? X, at least n times X{n,m}? X, at least n but not more than m times
对他们所做的事情的描述是相同的...那么,有什么区别呢?
我真的很感激一些例子。
我用Java编码,但我听说这个概念对于大多数现代正则表达式实现都是一样的。