ECMAScript does not correctly parse backreferences with a leading 0 in replacements
Bug Description
When using the replacements feature of Regex101, if the substitution regex with $01 is used, it will be treated as literal characters, $, 0, and 1, not the whole backreference of 01 which is the same as 1 in the "Explanation" and hover information.
Reproduction steps
Flavor: "ECMAScript"
Regex: /(d)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)/gm
Test: da
Substitution regex: $011boom
Expected Outcome
The part which says $01 should be highlighted as a backreference.
Actual: Each character is being treated literally in $01.
Browser
Librewolf version 140.0.4-1
OS
Debian Unstable (Sid)
Regex101 12.2.0
Hi @hueychen27
Not sure where the explanation is showing $01 as a reference group. This is what I understand you meant. Please advise if different:
@working-name Yes, this is what I mean. Sorry if it was not concise enough, you can edit my bug report description since I cannot come up with a different wording.
Funny syntax, thanks for bringing it to my attention. I'll put it on the back burner :)
Funny syntax indeed, but it is necessary if you have another number next to it but only want to select the first number. (PCRE2 in Regex101 provides ${} for this purpose)