help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: email extraction in emacs


From: B. T. Raven
Subject: Re: email extraction in emacs
Date: Fri, 1 Dec 2006 01:37:10 -0600

"Mathias Dahl" <address@hidden> wrote in message
news:address@hidden
> "a" <address@hidden> 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).

This sort of works interactively, that is it finds most of them. Blah is
missing a final parenthesis and I don't understand if addresses with 2 d's
is outside the scope of the let or not. Anyway, it just returns a list of
nils even if some email addresses are below the point of invocation in
*scratch.

address@hidden,4\}\b

Maybe all of the backslashes have to be doubled.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]