Regular expression precedence
The patterns, characters, and metacharacters of regular expressions comprise a sub language for working with strings. Some of the metacharacters can be understood as operators, and, like operators in all programming languages, there is an order of precedence. The following tables list regular expression operators in the order of their precedence.
Operator
|
Descriptions
|
\
|
Escape
|
(), (?:), (?=), (?!), []
|
Groups and sets
|
*, +, ?, {n}, {n,}, {n,m}
|
Repetition
|
^, $, \metacharacter
|
Anchors and metacharacters
|
|
|
Alternation
|
RegExp object instance properties