- Java Regex Tutorial
- Java Regex - Home
- Java Regex - Overview
- Java Regex - Capturing Groups
- Java Regex - MatchResult Interface
- Java Regex - Pattern Class
- Java Regex - Matcher Class
- PatternSyntaxException Class
- Java Regex Examples
- Java Regex - Characters
- Java Regex - Character Classes
- Predefined Character Classes
- POSIX Character Classes
- Java Regex - JAVA Character Classes
- Unicode Character Classes
- Java Regex - Boundary Matchers
- Java Regex - Greedy quantifiers
- Java Regex - Reluctant quantifiers
- Java Regex - Possessive quantifiers
- Java Regex - Logical Operators
- Java Regex Useful Resources
- Java Regex - Quick Guide
- Java Regex - Useful Resources
- Java Regex - Discussion
Examples of Reluctant Quantifiers
A reluctant quantifier indicates the search engine to start with the shortest possible piece of the string. Once match found, the engine continue; otherwise it adds one character to the section of the string being checked and search that, and so on. This process follows until it finds a match or the entire string has been used up. Following are various examples of Reluctant 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 |
Advertisements
To Continue Learning Please Login
Login with Google