You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Possessive quantifiers are like normal (a.k.a. "greedy") quantifiers, but do not backtrack.
65
+
66
+
-`*+`— Match zero or more instancs of the preceding atom without backtracking.
67
+
-`++`— Match one or more instancs of the preceding atom without backtracking.
68
+
-`?+`— Match zero or one instancs of the preceding atom without backtracking.
69
+
-`{n,}+`— Where _n_ is an integer. Matches the preceding atom at-least _n_ times without backtracking.
70
+
-`{n,m}+`— Where _n_ and _m_ are integers, and _m_ >= _n_. Matches the preceding atom at-least _n_ times and at-most _m_ times without backtracking.
Modifiers allow you to change the currently active RegExp flags within a subexpression.
84
+
85
+
-`(?imsux-imsux)`— Sets or unsets (using `-`) the specified RegExp flags starting at the current position until the next closing `)` or the end of the pattern.
86
+
-`(?imsux-imsux:subexpression)`— Sets or unsets (using `-`) the specified RegExp flags for the subexpression.
A Line Comment is a sequence of characters starting with `#` and ending with `\n` (or the end of the pattern) that is ignored by pattern matching and can be used to document a pattern.
An Atomic Group is a non-backtracking expression which is matched independent of neighboring patterns, and will not backtrack in the event of a failed match. This is often used to improve performance.
111
+
112
+
-`(?>pattern)`— Matches the provided pattern, but no backtracking is performed if the match fails.
A Conditional Expression checks a condition and evaluates its first alternative if the condition is true; otherwise, it evaluates its second alternative.
119
+
120
+
-`(?(condition)yes-pattern|no-pattern)`— Matches yes-pattern if condition is true; otherwise, matches no-pattern.
121
+
-`(?(condition)yes-pattern)`— Matches yes-pattern if condition is true; otherwise, matches the empty string.
-`(?=test-pattern)`— Evaluates to true if a positive lookahead for test-pattern matches; Otherwise, evaluates to false.
130
+
-`(?<=test-pattern)`— Evaluates to true if a positive lookbehind for test-pattern matches; Otherwise, evaluates to false.
131
+
-`(?!test-pattern)`— Evaluates to true if a negative lookahead for test-pattern matches; Otherwise, evaluates to false.
132
+
-`(?<!test-pattern)`— Evaluates to true if a negative lookbehind for test-pattern matches; Otherwise, evaluates to false.
133
+
-`(n)`— Evaluates to true if the capture group at offset _n_ was successfully matched; Otherwise, evaluates to false.
134
+
-`(<name>)`— Evaluates to true if the named capture group with the provided _name_ was successfully matched; Otherwise, evaluates to false.
135
+
-`('name')`— Evaluates to true if the named capture group with the provided _name_ was successfully matched; Otherwise, evaluates to false.
136
+
-`(R)`— Evaluates to true if inside a recursive expression; Otherwise, evaluates to false.
137
+
-`(Rn)`— Evaluates to true if inside a recursive expression for the capture group at offset n; Otherwise, evaluates to false.
138
+
-`(R&name)`— Evaluates to true if inside a recursive expression for the named capture group with the provided name; Otherwise, evaluates to false.
139
+
-`(DEFINE)`— Always evaluates to false. This allows you to define Subroutines.
140
+
141
+
## Subroutines
142
+
143
+
A Subroutine is a pre-defined capture group or named capture group that can be reused in multiple places within the pattern to re-evaluate the subexpression from the referenced group.
144
+
145
+
-`(?n)`— Where _n_ is an integer >= 1. Evaluates the capture group whose offset is _n_.
146
+
-`(?-n)`— Where _n_ is an integer >= 1. Evaluates the capture group whose offset is the _n_<sup>th</sup> capture group declared to the left of the current atom.
147
+
-`(?+n)`— Where _n_ is an integer >= 1. Evaluates the capture group whose offset is the _n_<sup>th</sup> capture group declared to the right of the current atom.
148
+
-`(?&name)`— Evaluates the named capture group with the provided name.
A Recursive Expression provides a mechanism for re-evaluating a capture group inside of itself, to handle cases such as matching balanced parenthesis or brackets, etc.
157
+
158
+
-`(?R)`, `(?0)`— Reevaluates the entire pattern starting at the current position.
0 commit comments