Page 1 of 1

8.1.2 replacement \\\i does not execute \i

Posted: Sun Mar 18, 2018 3:26 pm
by AmigoJack
The replacement \\\i should output a literal backslash and then an increment per match, so matches are replaced with the texts "\1", "\2", "\3" etc. But that's not the case.

However, if I use the replacement \\ \i the output is as expected: "\ 1", "\ 2", "\ 3" etc. But I don't want another character between the backslash and the increment.

To me this looks like a bug, as there's no way to achieve what I want (in one step).

Posted: Mon Mar 19, 2018 5:02 pm
by ben_josephs
I can reproduce this. Try \\(\i) or (\\)\i instead.

Posted: Tue Mar 27, 2018 9:46 am
by AmigoJack
Oh, both of those work - I never expected the replacement to have any function for parenthesis. Another workaround is using \x5c\i.

Do you have an explanation why TextPad is overreacting here?

Posted: Tue Mar 27, 2018 10:29 am
by ben_josephs
Look in TextPad's help in the section Reference Information | Replacement Format Strings. Parentheses are often required when using conditional replacement expressions (not a common occurrence).

Sequence number generation and regex replacement are separate mechanisms. Perhaps something goes wrong when one butts up against the other.