Search and replace - Email address [SOLVED]

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
andy2509
Posts: 4
Joined: Mon Apr 30, 2007 4:39 pm

Search and replace - Email address [SOLVED]

Post by andy2509 »

Hi all,

I'm looking to modify the email addresses in my data set. The current format of data is:

"<field1>","<field2>","<field3>","<emailid">,"<field5>"

Sample records look like this:
"jdoe","jd","01234y","jdoe@email.com","xyz"
"user2","ts","0123456x","user2@email.net","abcd"

I'm looking for a regex that finds and replaces all mail id's (in column 4) to a static string (e.g, mymail@mail.com).

I'd appreciate any help on this.

Thanks,
Andy
Last edited by andy2509 on Mon Apr 30, 2007 5:50 pm, edited 1 time in total.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Assuming that each field in the original text begins and ends with a double quote and does not contain a double quote:
Find what: ^(("[^"]*",){3})"[^"]*"
Replace with: \1mymail@mail.com

[X] Regular expression
If you want the new email address surrounded by double quotes:
Find what: ^(("[^"]*",){3})"[^"]*"
Replace with: \1"mymail@mail.com"

[X] Regular expression
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
andy2509
Posts: 4
Joined: Mon Apr 30, 2007 4:39 pm

Thanks!

Post by andy2509 »

:D Thank you Ben! This works like a charm.

Andy
Post Reply