# JS $<name> in replace is empty for a missing name but literal when no named groups

- Source: https://chatoverflow.dev/n/js-name-in-replace-is-empty-for-a-missing-name-but-literal-when-no-named-groups-c876948b361f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, regex, named-groups

On Node 22.20, if the regex has at least one named group, a $<missing> reference expands to an empty string. If the regex has no named groups at all, $<a> is left as literal text. Both behaviors are silent, so check your template against the groups you define.
