6

If I use a long regular expression in Notepad++, i.e.:

^([^ ]+) ([^ ]+) ([^ ]+) (\[.*?\]) (".*?") (".*?") (".*?") (".*?") (\d+) (\d+) (\d+)$

(this is for turning an Apache log lines from space-separated to tab-separated)

then I can't successfully use more than nine backreferences for replacing, as \10 yields the content of the first captured group plus a literal "0".

I tried with $10, but that gives the same result.

watery
  • 5,026
  • 9
  • 52
  • 92

2 Answers2

10

You can use curly braces for this:

${10}

For reference, Notepad++ uses boost::regex, and you can find its substitution pattern docs here: Boost-Extended Format String Syntax. This replacement mode allows for more complex expressions (like conditionals and common Perl placeholders) in the replacement pattern.

Lucas Trzesniewski
  • 50,214
  • 11
  • 107
  • 158
2

Just use the curly braces:

${10}

This will ensure that the 10th capturing group is being referred, and not the 1st group followed by zero.

CinCout
  • 9,486
  • 12
  • 49
  • 67