Groups and Backreferences: Capturing, Named Groups, Non-capturing Groups, Alternation and $1/${name} in Replacements
Capturing groups are numbered by the order of their opening parentheses, but .NET puts named groups last, so the same $2/$1 replacement gives different results in .NET and JavaScript. We compare named group syntaxes, ES2025 duplicate group names, finding repeated words with backreferences, POSIX's longest-match rule and the replacement syntax of .NET, JavaScript, sed and VS Code with real output, and fix author names in Bookstore's CSV.
15 Nov 2026
·
12 min
·
5