Search - Multiline replace up to a certain string

General questions about using TextPad

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

Post Reply
ilovetextpad
Posts: 13
Joined: Thu Sep 29, 2005 6:53 am

Search - Multiline replace up to a certain string

Post by ilovetextpad »

I have about 1200 files I'm working with, and I want to remove all text that comes before a certain string I know I could use \n if I knew how many lines I was going to replace, but some of the files have only 1 line before it, some have up to 30. I want to remove everything that precedes it, without having to do a search and replace 30 times...I searched and found some threads from 2002 saying Textpad couldn't do it, but I was hoping that had changed.

Thanks
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

You might consider replacing \n with a unique character (~)? or string like "qzqz". That will turn the text into one long string.

Now search for your strings, parse as needed, then replace all "qzqz" with \n

If that is too much to handle, then maybe use the same approace in selected text vs. whole document. Select first 100 line, then 101-200, 201-300, etc. Means multiple processing, but will probably get the job done.
Hope this was helpful.............good luck,
Bob
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

WildEdit might also be an option ...
ilovetextpad
Posts: 13
Joined: Thu Sep 29, 2005 6:53 am

Post by ilovetextpad »

I ended up finding a program that would solve this problem for me, but a new problem arose (isn't that how it always happens?)

The files are saved as html, but I need to remove it while preserving the paragraph and line breaks(replace <p> with double \n, br with single \n, the problem is that some of the p tags are just <p> and some are <p align="*">, when I try to do a search and replace it says recursion too deep. Any ideas?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You haven't told us what you searched for.

Does this not work?
Find what: <p[^>]*>
Replace with: [Nothing]

[X] Regular expression
Post Reply