Trouble with parentheses in Regular Expressions

General questions about using TextPad

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

Post Reply
joezeppy
Posts: 6
Joined: Tue Feb 15, 2005 4:49 pm

Trouble with parentheses in Regular Expressions

Post by joezeppy »

Hi,

I'm trying to search and replace data in a text file using TextPad.

I'd like to replace anything in the file that is between parentheses with a comma.

So

Necturus maculosus (Rafinesque, 1818) Mudpuppy
Necturus punctatus (Gibbes, 1850) Dwarf Waterdog
Necturus punctatus lodingi Viosca, 1937 Mobile Dwarf Waterdog
Necturus punctatus punctatus (Gibbes, 1850) Dwarf Waterdog

Will become

Necturus maculosus , Mudpuppy
Necturus punctatus , Dwarf Waterdog
Necturus punctatus lodingi Viosca, 1937 Mobile Dwarf Waterdog
Necturus punctatus punctatus , Dwarf Waterdog

There are thousands of instances like this.

Any ideas?

I can usually use basic regular expressions but I often get stumped when special characters are part of what I want to replace or delete.

TIA
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Welcome to the forum joezeppy!

I find life a lot better since I started using POSIX regex's ;)

Find \([^)]*\)
Replace ,
I have used POSIX regular expression syntax, which can be selected from the Editor page of the Preferences dialog box. HTH
Then I open up and see
the person fumbling here is me
a different way to be
joezeppy
Posts: 6
Joined: Tue Feb 15, 2005 4:49 pm

I'll give it a try

Post by joezeppy »

Thanks so much.

I'll give it a try.

*Update*

Holy Cow. It worked perfectly.

Thanks so much.

The world is so much better for sharing people like you.

Thanks!

One more thing. Do you think it is a good idea to just keep my TextEdit set to POSIX? (I get that impression from your post).

I'm just wondering if there are any other effects that I should be concerned about. I use TexPad mostly for text and data manipulation, to massage spreadsheets and datafeeds, for normal writing, etc.

BTW, Thanks to TextPad.com!!!! This is the most useful program I have on my computer. I use it often and EVERY DAY. I love it.
Post Reply