Search code examples
regexnotepad++

Notepad++ Regex Replace Capture Groups With Numbers


So I have numbers that I'm trying to replace in Notepad++ and I have to tweak both positive values and negative ones, so my search looks like this:

v (.{0,1})13.500000

And the replace:

v $1 10.500000

Except I don't want the space there between the capture group reference and the other digits, but if I leave the space out, it places nothing (no capture group #110).

How do I "escape" it so that the capture group is separate from the character-literals without inserting an unwanted character?

I could do this as two replacements, but I figured this must be possible, although I can't figure out how to search for it.

Sample source text:

v 13.000000 19.0000000 8.000000
v 13.000000 19.0000000 9.000000
v -13.000000 19.0000000 9.000000
v -13.000000 19.0000000 8.000000

Desired result:

v 10.000000 19.0000000 8.000000
v 10.000000 19.0000000 9.000000
v -10.000000 19.0000000 9.000000
v -10.000000 19.0000000 8.000000

Solution

  • Try this replacement:

    v ${1}10.500000