Feature: Lazy Quantifiers
Home | Features | Improve this section
Lazy Quantifiers specify repetition of an Atom, but attempt to match as few instances of the preceding Atom as possible to satisfy the pattern before advancing.
Syntax
NOTE: The following syntax is an example based on some of the supported engines. For specific engine support, see Engines.
*?
— Matches the preceding Atom zero or more times.+?
— Matches the preceding Atom one or more times.??
— Matches the preceding Atom zero or one times.{n}?
— Where n is an integer. Matches the preceding Atom exactly n times.{n,}?
— Where n is an integer. Matches the preceding Atom at-least n times.{n,m}?
— Where n and m are integers, and m >= n. Matches the preceding Atom at-least n times and at-most m times.
Engines
Engine | Supported |
---|---|
Perl | ✔ |
PCRE | ✔ |
Boost.Regex | ✔ |
.NET | ✔ |
Oniguruma | ✔ |
Hyperscan | ✔ |
ICU | ✔ |
Glib/GRegex | ✔ |
ECMAScript | ✔ |