Named capture groups in regular expressions (original) (raw)
Code units
Unicode Characters
Replacement text
0x0024, 0x0024
$$
$
0x0024, 0x0026
$&
matched
0x0024, 0x0060
$`
If position is 0, the replacement is the empty String. Otherwise the replacement is the substring of str that starts at index 0 and whose last code unit is at index position - 1.
0x0024, 0x0027
$'
If tailPos ≥ stringLength, the replacement is the empty String. Otherwise the replacement is the substring of str that starts at index tailPos and continues to the end of str.
0x0024, N
Where
0x0031 ≤ N ≤ 0x0039
$n
wheren
is one of 1 2 3 4 5 6 7 8 9
and $n
is not followed by a decimal digit
The nth element of captures, where n is a single digit in the range 1 to 9. If n≤m and the nth element of captures is undefined, use the empty String instead. If n>m, the result is implementation-defined.
0x0024, N, N
Where
0x0030 ≤ N ≤ 0x0039
$nn
wheren
is one of 0 1 2 3 4 5 6 7 8 9
The nnth element of captures, where nn is a two-digit decimal number in the range 01 to 99. If nn≤m and the nnth element of captures is undefined, use the empty String instead. If nn is 00 or nn>m, no replacement is done.
0x0024, 0x003C
$<
- If namedCaptures is undefined, the replacement text is the String
"$<"
. - Otherwise,
- Scan until the next
>
. - If none is found, the replacement text is the String
"$<"
. - Otherwise,
- Scan until the next
0x0024
$
in any context that does not match any of the above.
$