Page 1 of 1
Search - Multiline replace up to a certain string
Posted: Wed Feb 15, 2006 7:42 pm
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
Posted: Wed Feb 15, 2006 8:51 pm
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.
Posted: Wed Feb 15, 2006 9:15 pm
by MudGuard
WildEdit might also be an option ...
Posted: Fri Feb 17, 2006 6:38 pm
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?
Posted: Fri Feb 17, 2006 8:11 pm
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