Page 1 of 1

Regular expression question

Posted: Mon Dec 18, 2000 4:54 pm
by Javier Cardona
Hi,

I have a small application that parses a text file and deletes all the lines that do *not* contain a certain string. Is that something that can be done using Regular Expressions under TextPad?

Thanks!

Javier

Re: Regular expression question

Posted: Tue Dec 19, 2000 1:49 am
by Andreas
There are two ways:
1. The Textpad way
Clear all bookmarks (in Search menu)
Open Find box, type your Expression and select all necessary settings (like Match case...)
Instead of "Find"-Button use "Mark All" button.
Now Invert All Bookmarks (in Search menu) - by now all lines NOT containing the RE are bookmarked
Now delete all bookmarked lines (Edit/Delete/All Bookmarked lines)

2. The external Tool way
If your small application can be invoked with command line parameters, you could set it up as a Textpad tool.

Andreas

Re: Regular expression question

Posted: Tue Dec 19, 2000 2:00 am
by Jörg Frech
No, not with REs, but you can do it nonetheless:
- Open the search dialogue, enter your search string and press the "Mark All" button (by the way, the dialogue is non-modal, so you may leave it open as long as you wish).
- Select the whole document (Ctrl-A) and press Ctrl-F2 (Toggle Bookmark).
- Then, from the Edit Menu select Delete - Bookmarked Lines.

Jörg