Parentheses can be used as "memory" for relating different parts of a match or for substitution |
If subexpressions are enclosed in parentheses, the matched values are put in temporary variables \1, \2, etc.
|
Parentheses are also used to clarify the meaning of a regular expression. For instance,
|
In regular expressions, variables are interpolated as in double-quoted strings. Use \$ to represent a literal dollar sign except at end of string where it represents end-of-string anchor. |