Closed gibson042 closed 7 years ago
We actually just recently adopted the semantics you're raising this issue about, in https://github.com/tc39/proposal-regexp-named-groups/issues/29 . We've already been back and forth once, and implementations are already starting to ship, so I'd really prefer not to revisit this again. cc @msaboff @schuay
Hmm, just missed it I suppose. Damn.
https://tc39.github.io/proposal-regexp-named-groups/#table-45 specifies very careful treatment of replacement strings including
$<
, but I'd rather see code like'2015-01-02'.replace(re, '$<month> $<day, $<year>')
and'2015-01-02'.replace(re, '$<month> $<day>, $<year')
call attention to developer errors by throwing exceptions rather than masking them with identity- or empty-string replacements.IOW,