📜  贪婪量词的Java正则表达式

📅  最后修改于: 2020-11-14 10:21:18             🧑  作者: Mango


贪婪的量词指示搜索引擎搜索整个字符串,并检查其是否与给定的正则表达式匹配。以下是在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