Page 1 of 1

Search and replace - Email address [SOLVED]

Posted: Mon Apr 30, 2007 4:48 pm
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

Posted: Mon Apr 30, 2007 5:18 pm
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

Thanks!

Posted: Mon Apr 30, 2007 5:50 pm
by andy2509
:D Thank you Ben! This works like a charm.

Andy