The new expression matches the same set of strings as the previous one, but does not capture the prefix of X characters.
|Group 1||Group 2||Group 3||Group 4|
An quantifier in a regular expression may be greedy (the default), reluctant, or possesive. A reluctant quantifier does this:
An quantifier is made reluctant by appending a question mark.
X+? matches X one or more times,
but matches as few X as it can without preventing other quantifier from matching.
For example, when the expression
matches the string
X+? could potentially match
the entire string.
matches as little as possible: the first X .
[A-Z]+ of the expression matches the rest the string.
Reluctant quantifier are sometimes called lazy quantifier, because they match as little as possible.
Here is a string: XXXXX
What parts of the string match the capture group in the following expressions?