Quick Start
Tutorial
Search & Replace
Tools & Languages
Examples
Reference
Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Shorthands
Anchors
Word Boundaries
Quantifiers
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Unicode Characters and Properties
Unicode Versions
Unicode Categories
Unicode Scripts
Unicode Blocks
Unicode Binary Properties
Unicode Property Sets
Unicode Boundaries
Mode Modifiers
Recursion & Balancing Groups
Backtracking Control Verbs
Replacement Reference
Characters
Matched Text & Backreferences
Case Conversion
Context
Conditionals
More on This Site
Introduction
Regular Expressions Quick Start
Regular Expressions Tutorial
Replacement Strings Tutorial
Applications and Languages
Regular Expressions Examples
Regular Expressions Reference
Replacement Strings Reference
Book Reviews
Printable PDF
About This Site
RSS Feed & Blog
RegexBuddy—Better than a regular expression reference!

Regular Expression Backtracking Control Verb Reference

FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE PCRE2 PHP Delphi R Ruby std::regex Boost Tcl POSIX GNU Oracle XML XPath
Control verb (*FAIL) or (*F) Fail to match, forcing the engine to backtrack, when reached during the normal matching process. a(*F)b|c matches c in abc nononononononononoYES7.4YESYESYESYESnonoECMA
1.60
nononononono
Control verb (*ACCEPT) Accept the match so far as the overall match when reached during the normal matching process. a(*ACCEPT)b|c matches a nononononononononoYES7.4YESYESYESYESnonoECMA
1.60
nononononono
Control verb (*ACCEPT) inside a capturing group. Accept the match so far of each parent capturing group in addition to accepting the overall match. a(b(*ACCEPT)c)d|e matches ab n/an/an/an/an/an/an/an/an/aYES8.00YESYESXE7YESn/an/aECMA
1.60
n/an/an/an/an/an/a
Control verb (*ACCEPT) Accept the match so far of the atomic group and continue matching the remainder of the regex when reached during the normal matching process. a(?>b(*ACCEPT)c).|d matches abx n/an/an/an/an/an/an/an/an/aYES7.4–8.02nonoXE–XE6non/an/aECMA
1.60
n/an/an/an/an/an/a
Control verb (*COMMIT) Commit to failure by stopping the matching process entirely when reached while backtracking. ab+(*COMMIT)d+|.{3} fails to match abbbccc nononononononononoYES7.4YESYESYESYESnonoECMA
1.60
nononononono
Control verb (*SKIP) Skip the match attempt by restarting the matching process at the position of (*SKIP) when reached while backtracking. ab+(*SKIP)d+|.{3} matches ccc in abbbccc nononononononononoYES7.4YESYESYESYESnonoECMA
1.60
nononononono
Control verb argument (*:ARG) and (*SKIP:ARG) Skip the match attempt by restarting the matching process at the position where (*:ARG) was reached during the normal matching process before (*SKIP:ARG) was reached while backtracking. a+(*:ARG)b+(*SKIP:ARG)d+|.{3} matches bbb in aaabbbccc nononononononononoYES8.10YESYESXE7YESnonononononononono
Control verb argument (*MARK:ARG) and (*SKIP:ARG) Skip the match attempt by restarting the matching process at the position where (*MARK:ARG) was reached during the normal matching process before (*SKIP:ARG) was reached while backtracking. a+(*MARK:ARG)b+(*SKIP:ARG)d+|.{3} matches bbb in aaabbbccc nononononononononoYES8.10YESYESXE7YESnonononononononono
Control verb (*PRUNE) Prune all backtracking positions when reached while backtracking, failing the match attempt but allowing the regex to advance one character and restart the matching process. ab+(*PRUNE)d+|.{3} matches bbb in abbbccc nononononononononoYES7.4YESYESYESYESnonoECMA
1.60
nononononono
Control verb (*THEN) If reached while backtracking then cancel the current alternative and continue with the next alternative. ab+(*THEN)d+|.{3} matches abb in abbbccc nononononononononoYES7.4YESYESYESYESnonononononononono
Control verb (*THEN) If reached while backtracking then cancel the innermost group that has alternative and continue with the remainder of the regex as if that group failed to match. a(b+(*THEN)d+|.{2})|a matches a in abbbccc nononononononononononononononononoECMA
1.60
nononononono
FeatureSyntaxDescriptionExampleJGsoft Python JavaScript VBScript XRegExp .NET Java ICU RE2 Perl PCRE PCRE2 PHP Delphi R Ruby std::regex Boost Tcl POSIX GNU Oracle XML XPath