How do you reference a named capture group in regex find and replace in Visual Studio Code? [duplicate]
Solution 1:
If you want to use an inline backreference, they work in VSCode.
(?<group>[a-z]+) \d+ \k<group>
matches abc 1 abc
.
However, new JavaScript-like $<group>
replacement does not work, .NET-style replacement backreference, ${group}
, does not work either, probably, due to the issue referred to by @JW.
NOTE: They say they need 20 votes on the issue and there are 3 days to go before they close the issue and turn down the suggestion to introduce backreferences in replacement. If you want this feature to be implemented, please consider voting for that issue.