8.1.2 replacement \\\i does not execute \i

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
AmigoJack
Posts: 531
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

8.1.2 replacement \\\i does not execute \i

Post 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).
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

I can reproduce this. Try \\(\i) or (\\)\i instead.
User avatar
AmigoJack
Posts: 531
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post 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?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
Post Reply