Javaregex 简明教程

Java Regexs of Greedy Quantifiers

贪婪限定符指示搜索引擎搜索整个字符串并检查它是否与给定的正则表达式匹配。以下是使用正则表达式在 Java 中使用贪婪限定符的各种示例。

A greedy quantifier indicates to search engine to search the entire string and check whether it matches the given regexp. Following are various examples of Greedy Quantifiers using regular expression in java.

Sr.No

Construct & Matches

1

X?X, once or not at all.

2

X*X, zero or more times

3

X+X, one or more times.

4

X{n}X, exactly n times.

5

X{n,}X, at least n times.

6

X{n,m}X, at least n but not more than m times