|
|
Emacs regexp
|
|
|
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
I've got a problem with a light CMS driven site. I should change all emails in the content tables to the form [email protected]. I think a good solution would be to run an emacs regexp on the dump.
The problem is I'm a novice with regexp. What is the right expression and how do I use it in Emacs?
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status:
Offline
|
|
Umm, it might help if you let us know the format of the email addresses! That is, give us a sample email address: what it currently is and what you'd like it to be. Be as precise as you can and I'm sure someone will throw a regex based solution in your direction. (Not so sure it'll be for emacs though!)
Cheers,
Paul
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Dec 2002
Status:
Offline
|
|
Originally posted by Paul McCann:
Umm, it might help if you let us know the format of the email addresses! That is, give us a sample email address: what it currently is and what you'd like it to be. Be as precise as you can and I'm sure someone will throw a regex based solution in your direction. (Not so sure it'll be for emacs though!)
Cheers,
Paul
Sorry about that. So the site now has mixed emails (using two different domains) like [email protected] and [email protected]. All of these should be changed to [email protected] (not jane.doe or john.doe, but firstname.lastname) to avoid email harvesters.
I've no idea on regexp syntax, but using traditional wildcards it would be something like this: *.*@*.org => [email protected]
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status:
Offline
|
|
OK, if I'm understanding you correctly, the following should make all the email addresses it trips across into the generic [email protected]
Code:
perl -pi.bak -e 's/[a-z.]+\@[a-z.]+\.org/firstname.lastname\@vet.org/g' filename
where "filename" is the file containing your dump of email addresses (and possibly some other stuff, which will be left in tact). The original dump will be sitting in "filename.bak" after you execute the command.
Let us know if it doesn't work as expected.
Cheers,
Paul
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|