I want to turn an Apache log lines from space-separated to tab-separated format.
If I use a long regular expression in Notepad++, i.e.:
^([^ ]+) ([^ ]+) ([^ ]+) (\[.*?\]) (".*?") (".*?") (".*?") (".*?") (\d+) (\d+) (\d+)$
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.
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.