| Feature | Syntax | Description | Example | specRegex | .NET | std::regex | PCRE2 | RE2 |
|---|---|---|---|---|---|---|---|---|
| Backslash | A backslash that does not form a token | Invalid escapes insert the escaped character literally. | \! inserts ! |
❌ | ❌ | ✔ (Opt) | ✔ (Opt) | ❌ |
| Backslash | A backslash that does not form a token | A backslash that is not part of a replacement string token is a literal | \! inserts \! |
✔ | ✔ | ✔ | ✔ | ❌ |
| Backslash | Trailing backslash | Trailing backslash is literal backslash | \ at the end inserts \ |
✔ | ✔ | ✔ | ✔ | ❌ |
| Backslash | \\ |
A backslash escapes itself | \\ inserts \ |
❌ | ❌ | ✔ (Opt) | ✔ (Opt) | ✔ |
| Dollar | A dollar that does not form a token | A dollar that does not form a token is a literal dollar | $! inserts $! |
✔ | ✔ | ✔ | ❌ | ✔ |
| Dollar | Trailing dollar | A trailing dollar is a literal dollar | $ at the end inserts $ |
✔ | ✔ | ✔ | ❌ | ✔ |
| Dollar | $$ |
A dollar escapes itself | $$ inserts $ |
✔ | ✔ | ✔ | ✔ | ❌ |
| Dollar | \$ |
A backslash escapes a dollar | \$ inserts $ |
✔ | ✔ | ✔ | ✔ | ❌ |
| Hexadecimal escape | \xFF where FF are 2 hexadecimal digits |
Insert the single-byte character FF |
✔ | ❌ | ✔ | ✔ | ❌ | |
| Character escape | \n, \r and \t |
Insert an LF character, CR character and a tab character respectively | \r\n inserts a CRLF line break |
✔ | ❌ | ✔ | ✔ | ❌ |
| Character escape | \a |
Insert the “alert” or “bell” control character (ASCII 0x07) | ✔ | ❌ | ❌ | ✔ | ❌ | |
| Character escape | \b |
Insert the “backspace” control character (ASCII 0x08) | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Character escape | \e |
Insert the “escape” control character (ASCII 0x1A) | ✔ | ❌ | ❌ | ✔ | ❌ | |
| Character escape | \f |
Insert the “form feed” control character (ASCII 0x0C) | ✔ | ❌ | ❌ | ✔ | ❌ | |
| Character escape | \v |
Insert the “vertical tab” control character (ASCII 0x0B) | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Control character escape | \cA through |
ASCII character ^A through ^Z, equivalent to \x01 through\x1A |
\cM\cJ inserts a CRLF linebreak |
✔ | ❌ | ❌ | ✔ | ❌ |
| Control character escape | \ca through |
ASCII character ^A through ^Z, equivalent to \x01 through\x1A |
\cm\cj inserts a CRLF linebreak |
✔ | ❌ | ❌ | ✔ | ❌ |
| NULL escape | \0 |
Insert the null character | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Octal escape | \o{7777} for any octal number |
Insert the character with the specified number | \o{20254} inserts € |
✔ | ❌ | ❌ | ✔ | ❌ |
| Octal escape | \1 through \7 |
Insert the character at the specified position in the ASCII table | \7 inserts the “bell” character |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \10 through \77 |
Insert the character at the specified position in the ASCII table | \77 inserts ? |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \100 through \177 |
Insert the character at the specified position in the ASCII table | \100 inserts @ |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \200 through \377 |
Insert the character at the specified position in the active code page | \377 inserts ÿ |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \400 through \777 |
Insert the character at the specified position in the active code page | \777 inserts ǿ |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \01 through \07 |
Insert the character at the specified position in the ASCII table | \07 inserts the “bell” character |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \010 through \077 |
Insert the character at the specified position in the ASCII table | \077 inserts ? |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \0100 through \0177 |
Insert the character at the specified position in the ASCII table | \0100 inserts @ |
❌ | ❌ | ❌ | ❌ | ❌ |
| Octal escape | \0200 through \0377 |
Insert the character at the specified position in the active code page | \0377 inserts ÿ |
❌ | ❌ | ❌ | ❌ | ❌ |
| Feature | Syntax | Description | Example | specRegex | .NET | std::regex | PCRE2 | RE2 |
|---|---|---|---|---|---|---|---|---|
| Ampersand | \& |
Insert a literal ampersand | \& inserts & |
❌ | ❌ | ✔ (Opt) | ✔ (Opt) | ❌ |
| Whole match | \& |
Insert the whole regex match | \& inserts the entire match |
✔ | ❌ | ❌ | ❌ | ❌ |
| Whole match | $& |
Insert the whole regex match | $& inserts the entire match |
✔ | ✔ | ✔ | ❌ | ❌ |
| Whole match | & |
Insert the whole regex match | & inserts the entire match |
❌ | ❌ | ✔ (Opt) | ❌ | ❌ |
| Whole match | \0 |
Insert the whole regex match | \0 inserts the entire match |
❌ | ❌ | ✔ (Opt) | ❌ | ✔ |
| Whole match | $0 |
Insert the whole regex match | $0 inserts the entire match |
✔ | ✔ | ✔ | ✔ | ❌ |
| Whole match | \g<0> |
Insert the whole regex match | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Whole match | $MATCH and ${^MATCH} |
Insert the whole regex match | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Backreference | \1 to \9 |
Insert the text matched by one of the first 9 capturing groups. | \3 inserts capture group 3 |
✔ | ❌ | ✔ (Opt) | ❌ | ✔ |
| Backreference | \10 to \99 |
Insert the text matched by one of the latter 89 capturing groups. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Backreference and literal | \10 to \99 |
For <10 groups in regex, treat second digit as a literal | \33 may insert <group 3>3 |
✔ | ❌ | ❌ | ❌ | ✔ |
| Backreference | $1 to $9 |
Insert the text matched by one of the first 9 capturing groups. | $3 inserts capture group 3 |
✔ | ✔ | ✔ | ✔ | ❌ |
| Backreference | $10 to $99 |
Insert the text matched by one of the latter 89 capturing groups. | ✔ | ✔ | ✔ | ✔ | ❌ | |
| Backreference and literal | $10 to $99 |
For <10 groups in regex, treat second digit as a literal | $33 may insert <group 3>3 |
✔ | ✔ (Opt) | ❌ | ❌ | ❌ |
| Backreference | ${1} to ${99} |
Insert the text matched by a numbered capturing group | ${3} inserts group 3 |
✔ | ✔ | ❌ | ✔ | ❌ |
| Backreference | \g<1> to \g<99> |
Insert the text matched by a numbered capturing group | \g<3> inserts group 3 |
✔ | ❌ | ❌ | ❌ | ❌ |
| Named Backreference | ${name} |
Insert the text matched by named group name |
${foo} inserts group foo |
✔ | ✔ | ❌ | ✔ | ❌ |
| Named Backreference | $+{name} |
Insert the text matched by named group name |
${foo} inserts group foo |
✔ | ❌ | ❌ | ❌ | ❌ |
| Named Backreference | $name |
Insert the text matched by named group name |
$foo inserts group foo |
❌ | ❌ | ❌ | ✔ | ❌ |
| Named Backreference | \g<name> |
Insert the text matched by named group name |
\g<foo> inserts group foo |
❌ | ❌ | ❌ | ❌ | ❌ |
| Invalid backreference | Any backref with nonexistent name/number | An out-of-bounds backreference is the empty string. | ✔ | ❌ | ✔ | ❌ | ❌ | |
| Invalid backreference | Any backref with nonexistent name/number | An out-of-bounds backreference is a literal | ❌ | ✔ | ❌ | ❌ | ❌ | |
| Nonparticipating backreference | Any backreference with to nonparticipant | A non-participating backreference is the empty string | ✔ | ✔ | ✔ | ❌ | ✔ | |
| Last backreference | \+ |
Inserts the highest-numbered participating group | ❌ | ❌ | ❌ | ❌ | ❌ | |
| Last backreference | \+ |
Inserts the highest-numbered group, regardless of participation | ❌ | ❌ | ❌ | ❌ | ❌ | |
| Last backreference | $+ |
Inserts the highest-numbered participating group | ❌ | ❌ | ❌ | ❌ | ❌ | |
| Last backreference | $+ |
Inserts the highest-numbered group, regardless of participation | ❌ | ✔ | ❌ | ❌ | ❌ | |
| Last backreference | $^N |
Inserts the highest-numbered participating group | ❌ | ❌ | ❌ | ❌ | ❌ | |
| Last backreference | $LAST_SUBMATCH_RESULT, ${^LAST_SUBMATCH_RESULT} |
Inserts the highest-numbered participating group | ❌ | ❌ | ❌ | ❌ | ❌ | |
| Last backreference | $LAST_PAREN_MATCH, ${^LAST_PAREN_MATCH} |
Inserts the highest-numbered group, regardless of participation | ❌ | ❌ | ❌ | ❌ | ❌ |
| Feature | Syntax | Description | Example | specRegex | .NET | std::regex | PCRE2 | RE2 |
|---|---|---|---|---|---|---|---|---|
| Match Context | \` |
Insert the part of the subject string to the left of the regex match. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Match Context | $` |
Insert the part of the subject string to the left of the regex match. | ✔ | ✔ | ✔ | ❌ | ❌ | |
| Match Context | $PREMATCH, ${^PREMATCH} |
Insert the part of the subject string to the left of the regex match. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Match Context | \' |
Insert the part of the subject string to the right of the regex match. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Match Context | $' |
Insert the part of the subject string to the right of the regex match. | ✔ | ❌ | ✔ | ❌ | ❌ | |
| Match Context | $POSTMATCH, ${^POSTMATCH} |
Insert the part of the subject string to the right of the regex match. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Match Context | \_ |
Insert the entire subject string. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Match Context | $_ |
Insert the entire subject string. | ✔ | ✔ | ❌ | ❌ | ❌ | |
| Case Conversion | \U0 to \U99 |
Insert a numbered group (or whole match), converted to uppercase. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Case Conversion | \L0 to \L99 |
Insert a numbered group (or whole match), converted to lowercase. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Case Conversion | \F0 to \F99 |
Convert the first character to uppercase, and the rest to lowercase. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Case Conversion | \I0 to \I99 |
Insert a numbered group (or whole match), converted to title case. | ✔ | ❌ | ❌ | ❌ | ❌ | |
| Case Conversion | \U |
Everything until the next \E or \L is uppercased |
✔ | ❌ | ❌ | ✔ | ❌ | |
| Case Conversion | \L |
Everything until the next \E or \U is uppercased |
✔ | ❌ | ❌ | ✔ | ❌ | |
| Case Conversion | \u |
The next character is uppercased | ❌ | ❌ | ❌ | ✔ | ❌ | |
| Case Conversion | \l |
The next character is lowercased | ❌ | ❌ | ❌ | ✔ | ❌ |