keep/extract strings found by find/replace

General questions about using TextPad

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

Post Reply
cesine
Posts: 3
Joined: Tue Jul 15, 2003 6:17 pm

keep/extract strings found by find/replace

Post by cesine »

hi :)

can anyone tell me if there is a way that i can search(using find/replace) for anything between /(a forward slash) and -(a hyphen, obviously its not realy important what its between) then copies the instances it finds to a new file or to the clipboard or wherever... normally i could bookmark the lines and copy the bookmarked lines, except that every line has an instance of / ..... -

concrete example:

what im "finding"
/ [[:alpha:]\*'\. ]* -

in a file that looks like this:
/ ' t - b * l - k s n /
/ ' d - x * - . l A n /
/ . x - b * - ' l x - n p/

thanks :) (ive never written a macro before so im hoping someone already knows of one...)
Ed
Posts: 103
Joined: Tue Mar 04, 2003 9:09 am
Location: Devon, UK

Post by Ed »

1. Check under Configure->Preferences->keyboard->Edit->EditCopyAppend that this is assigned to Ctrl+Shift+C if not assign it.
2. Search for /[^-]*- (Regular expression)
3. Close (Find dialogue)
4. Copy (to clipboard)
5. Macro->Record
6. Ctrl-F (Find next)
7. Ctrl+Shift+C (copy append)
8. Macro->stop recording
9. give it a name and description and select "Repeat to end of file"
10. Play the macro.
11. The clipboard contains all the strings
cesine
Posts: 3
Joined: Tue Jul 15, 2003 6:17 pm

thankyou

Post by cesine »

thanks :)

i didnt know it was that simple :roll:
Post Reply