Makhele Sabata
Makhele Sabata

Reputation: 621

vscode Find and replace across files, backreference is repeated the if more than one match is on the same line

I am searching across files in vscode using the following regex expression

(?<=[a-zA-Z])_([a-zA-Z]) with $1

to replace Some_Random_Text with SomeRandomText

but vs code repeats the backreference value if they are on the same line as shown below S is repeated:

enter image description here

Upvotes: 0

Views: 233

Answers (1)

Mark
Mark

Reputation: 181359

That sure looks like a bug to me. It does not happen in the Find in the current file widget. You should file an issue on this - probably due to the Search across files handling the lookbehind (which should be no problem since it is fixed-width).

In the meantime, you can easily remove the lookbehind part and use:

find: ([a-zA-Z])_([a-zA-Z])
replace: $1$2

which works as it should.

Upvotes: 1

Related Questions