replace - How to delimit a regex group number in notepad++ replacement? -


i want specify captured group literal digit in replacement term, literal digit being interpreted part of group number.

given (contrived) example:

input text: a5 find: (.)(.) replace: $16 expected result: a6 actual result: <blank> 

experimentation suggests $16 being interpreted "group 16".

i tried using $1\6 make 6 literal, gave me group 1, blank \6 - ie result a. $1\\6 gave me a\6.

the general question is, "how specify group 1 literal number"?

notepad s&r regex powered boost regex library.

the unambiguous $n backreference achieved braces ({}) around id, so, can use ${1}6 replacement here.

notepad++ supports bre style backreferences starting \ (\1, \2 etc. *up 9). so, when use \16 in replacement pattern, engine parse backreference 1 + literal symbol 6. may check replacing (.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.) \11 in 1234567890a. instead of a (the 11th group) 11 result. $11 replacement result in a.

notepad++ help mentions these notations lacks details:

$n, ${n}, \n
returns matched subexpression numbered n. negative indices not alowed.


Comments