ECMAScript proposal: duplicate named capturing groups for regular expressions
Briefly

Duplicate named capturing groups in ECMAScript 2025 allow using the same capture group name multiple times in different alternatives, facilitating the reuse of regex fragments and match-processing code.
This feature is particularly beneficial for those who create parsers and tokenizers using regular expressions, providing a practical and advantageous addition.
Backreferences to duplicate named groups function as expected, demonstrating the potential and flexibility of this feature in regular expression usage.
Usage of string.matchAll(), Array.from(), and backreferences in examples showcase the practical application and advantages of Duplicate Named Capturing Groups in regular expressions.
Read at 2ality
[
add
]
[
|
|
]