关于量词的困惑?

时间:2017-11-28 14:07:41

标签: java regex

我正在阅读关于此链接上oracle的文档页面上的量词

https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

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

Possessive 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

我无法理解为什么这些东西的匹配相同? 即使他们分成不同的群体。

我甚至尝试过运行它们,并为每个人获得完全相同的东西。

所以问题是为什么?

0 个答案:

没有答案