Regular expression question

General questions about using TextPad

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

Post Reply
Javier Cardona

Regular expression question

Post 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
Andreas

Re: Regular expression question

Post 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
Jörg Frech

Re: Regular expression question

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