From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: email extraction in emacs Date: Thu, 30 Nov 2006 14:01:49 +0100 Message-ID: References: <1164819237.355277.217960@j72g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164894058 18984 80.91.229.2 (30 Nov 2006 13:40:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Nov 2006 13:40:58 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 30 14:40:54 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gpm9W-0006LE-1j for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Nov 2006 14:40:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gpm9V-0002nL-Gl for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Nov 2006 08:40:37 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 18 Original-X-Trace: individual.net Spv7dbFUTd3WujXvbPiZDw/4IDpCFFQr0r3Z6B+z1seEY/7D7K User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.90 (windows-nt) Cancel-Lock: sha1:Rcg/hGVHONefVAs0aD6Tux6j174= Original-Xref: shelby.stanford.edu gnu.emacs.help:143528 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39132 Archived-At: "a" writes: > if i have a text file filled with email addresses but other things > as well what commands can i use to extract the email address from > the file? You would probably need `search-forward-regexp' and `match-string'. The code below will not work but it will give you an idea on how to do it: (defun blah () (let (adresses) (while (search-forward-regexp "\\(REGEXP-MATCHING-EMAILS\\)" nil t) (setq addresses (append adresses (list (match-string 1))))) adresses) Matching e-mail addresses using a regexp can be tricky, if you want to support all variants (with `+' before the @ and such).