Regular expression là pattern match với input text. Substitutions dùng trong replacement patterns.
| Character | Mô tả | Pattern | Replacement | Input | Result |
|---|---|---|---|---|---|
| $number | Thay substring match bởi group number | \b(\w+)(\s)(\w+)\b | $3$2$1 | "one two" | "two one" |
| ${name} | Thay substring match bởi named group | \b(?<word1>\w+)(\s)(?<word2>\w+)\b | ${word2} ${word1} | "one two" | "two one" |
| $$ | Thay ký tự "$" literal | \b(\d+)\s?USD | $$$1 | "103 USD" | "$103" |
| $& | Thay toàn bộ match | (\$*(\d*(\.+\d+)?){1}) | **$& | "$1.30" | "**$1.30**" |
| $` | Thay text trước match | B+ | $` | "AABBCC" | "AAAACC" |
| $' | Thay text sau match | B+ | $' | "AABBCC" | "AACCCC" |
| $+ | Thay group cuối cùng captured | B+(C+) | $+ | "AABBCCDD" | AACCDD |
| $_ | Thay toàn bộ input string | B+ | $_ | "AABBCC" | "AAAABBCCC |