Feature: Backtracking Control Verbs
Home | Features | Improve this section
A Backtracking Control Verb is a special pattern usually in the form of (*VERB)
or (*VERB:arg)
that performs some special behavior with respect to backtracking.
Syntax
NOTE: The following syntax is an example based on some of the supported engines. For specific engine support, see Engines.
(*PRUNE)
,(*PRUNE:name)
— Prunes the backtracking tree.(*SKIP)
,(*SKIP:name)
— Prunes the backtracking tree and preceding text cannot be part of any match of the pattern.(*MARK:name)
,(*:name)
— Marks a point in the string where a certain part of the pattern has been matched.(*THEN)
,(*THEN:name)
— When backtracked into on failure causes the engine to attempt the next alternative in the innermost enclosing group with alternatives.(*COMMIT)
,(*COMMIT:arg)
— When backtracked into on failure causes the match to fail outright.(*FAIL)
,(*F)
,(*FAIL:arg)
— Matches nothing and always fails. Equivalent to(?!)
.(*ACCEPT)
,(*ACCEPT:arg)
— Causes the end of successful matching at the point where the verb was encountered.
Engines
Engine | Supported |
---|---|
Perl | ✔ |
PCRE | ✔ |
Boost.Regex | ❌ |
.NET | ❌ |
Oniguruma | ❌ |
Hyperscan | ❌ |
ICU | ❌ |
Glib/GRegex | ❌ |
ECMAScript | ❌ |