Mr Lister
Mr Lister

Reputation: 46629

Replacing regular expressions

I have googled and googled, honestly, but I can't find it.

Using Visual Studio 2012, how do you replace all A1, B1, C1 etc with A2, B2, C2 and so on?

When I try with ([A-Z])1 and replacement $12, it replaces everything with $12.

Now I realize that it thinks $12 is a backreference, and since it can't find the twelfth argument, it just inserts the literal text, but how can I tell it I want $1 to be the backreference?

I tried things like $1\2, $1\x32, $1\u0032, but all that doesn't work. ideas anyone?

Upvotes: 0

Views: 44

Answers (1)

Toto
Toto

Reputation: 91518

I don't know visual studio but in many languages, you can do the replace with:

${1}2

Upvotes: 2

Related Questions