Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Emacs regexp

Emacs regexp
Thread Tools
Nerozwei
Forum Regular
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jan 19, 2004, 03:21 AM
 
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?
     
Paul McCann
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status: Offline
Reply With Quote
Jan 20, 2004, 01:37 AM
 
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
     
Nerozwei  (op)
Forum Regular
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jan 20, 2004, 04:04 AM
 
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]
     
Paul McCann
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status: Offline
Reply With Quote
Jan 20, 2004, 08:57 PM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:11 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,