'Replace All' finding '\t|$' finds line ending infinitely

General questions about using TextPad

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

Post Reply
ionFreeman
Posts: 6
Joined: Fri Mar 03, 2006 3:19 pm

'Replace All' finding '\t|$' finds line ending infinitely

Post by ionFreeman »

I have some lines of tab delimited data, and I want pipe-delimited (and terminated) data. Since I have a leading tab, I search for '\t|$' and replace with '\|'. This creates and infinite loop -- it finds the line ending, replaces it with a '|' and finds the new line ending.

Replacing all \ts and $s separately works fine. But, 64-bit TextPad 7.4.0 can't handle the 'or' condition. Or something.
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Post by kengrubb »

Trying searching for (\t|$) rather than \t|$

If I am correct in understand that you have a leading tab you wish to retain, you could try this. This approach assumes there are no \xFF characters in your file.

RE Replace
Find: ^\t
Replace: \xFF

RE Replace
Find: \t
Replace: \|

RE Replace
Find: ([^\|])$
Replace: $1\|

RE Replace
Find: \xFF
Replace: \t
(2[Bb]|[^2].|.[^Bb])

That is the question.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Does this do what you want?
Find what: (\t|$)(.|\n)
Replace with: |$2

[X] Regular expression

Replace All
Post Reply