Backreference a named capture.
Section: JavaScript Flags and Captures
Named backreference in JS
javascript
javascript
/(?<q>["\']).*?\k<q>/Explanation
Useful for matching paired quotes.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing JavaScript Flags and Captures
Replacement with named groups
Use a replacement callback to access named captures clearly.
Common JS flags
Global, ignore-case, multiline, dotAll, Unicode, sticky, indices.
Replacement with numbered groups
Use `$1`, `$2`, etc. in replacement strings.