Export all regular expression matches in textpad or notepad+

General questions about using TextPad

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

Post Reply
Kiranshell
Posts: 1
Joined: Thu Sep 20, 2012 6:49 pm

Export all regular expression matches in textpad or notepad+

Post by Kiranshell »

In Textpad is there a option to export all the matches for a regular expression find, as a single list, I have tied the help document.

Context: in a big text file I am searching for tags (words enclosed by % %), using regular expression

Code: Select all

%\< and \>%
and want all the matches as a single list.

Thanks,
Kiran
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Your regex doesn't make a lot of sense.

Some of the following assumes you are using "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
If your tags are alphabetic you can use
%[a-z]+%
If they're alphanumeric you can use
%[a-z0-9]+%
If they're alphanumeric with spaces but must begin and end with an alphanumeric you can use
%[a-z][a-z ]*[a-z]%
or
%\<[a-z ]+\>%
And so on.

You can mark all the lines containing them with
Mark All

You can then copy the marked lines with
Edit | Copy Other | Bookmarked Lines
and paste them somewhere else.

If lines may contain more than one tag you can put them on separate lines with something like (depending on which regex you used to match the tags) this:
Find what: (%[a-z]+%[^%]*)%
Replace with: \1\n%

Replace All -- do this repeatedly until it beeps
You can trim text before and after the tags with something like (depending on which regex you used to match the tags) this:
Find what: .*(%[a-z]+%).*
Replace with: \1

Replace All
Post Reply