all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* email extraction in emacs
@ 2006-11-29 16:53 a
  2006-11-29 17:45 ` Leo
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: a @ 2006-11-29 16:53 UTC (permalink / raw)


email extraction in emacs

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?

ashish

ashish4@yahoo.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-11-29 16:53 email extraction in emacs a
@ 2006-11-29 17:45 ` Leo
  2006-11-29 17:49 ` Peter Dyballa
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Leo @ 2006-11-29 17:45 UTC (permalink / raw)


On Wednesday, 29 Nov 2006, a. wrote:

> email extraction in emacs
>
> 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?
>
> ashish
>
> ashish4@yahoo.com

(info "(elisp)Regular Expressions")

-- 
Leo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-11-29 16:53 email extraction in emacs a
  2006-11-29 17:45 ` Leo
@ 2006-11-29 17:49 ` Peter Dyballa
  2006-11-30 13:01 ` Mathias Dahl
  2006-11-30 19:54 ` martin
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2006-11-29 17:49 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 29.11.2006 um 17:53 schrieb a:

> 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?

Shell-command-on-region or replace-regxp or delete-region or ...

--
Greetings

   Pete

Who the fsck is "General Failure," and why is he reading my disk?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-11-29 16:53 email extraction in emacs a
  2006-11-29 17:45 ` Leo
  2006-11-29 17:49 ` Peter Dyballa
@ 2006-11-30 13:01 ` Mathias Dahl
  2006-12-01  7:37   ` B. T. Raven
  2006-11-30 19:54 ` martin
  3 siblings, 1 reply; 7+ messages in thread
From: Mathias Dahl @ 2006-11-30 13:01 UTC (permalink / raw)


"a" <ashish4112001@gmail.com> 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).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-11-29 16:53 email extraction in emacs a
                   ` (2 preceding siblings ...)
  2006-11-30 13:01 ` Mathias Dahl
@ 2006-11-30 19:54 ` martin
  3 siblings, 0 replies; 7+ messages in thread
From: martin @ 2006-11-30 19:54 UTC (permalink / raw)



 >>>>> a  <ashish4112001@gmail.com> writes:
 > Date: 29 Nov 2006 08:53:57 -0800
 > 
 > email extraction in emacs
 > 
 > 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?

Hi,

i would try to use somthing like

  bbdb/gnus-show-all-recipients
    Command: Show all recipients of this message. Counterpart to
             `bbdb/vm-show-sender'.

  bbdb/vm-show-all-recipients
    Command: Show all recipients of this message. Counterpart to
             `bbdb/vm-show-sender'.

Martin
-- 
parozusa at web dot de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-11-30 13:01 ` Mathias Dahl
@ 2006-12-01  7:37   ` B. T. Raven
  2006-12-01 12:20     ` Mathias Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: B. T. Raven @ 2006-12-01  7:37 UTC (permalink / raw)



"Mathias Dahl" <brakjoller@gmail.com> wrote in message
news:u64cxccle.fsf@gmail.com...
> "a" <ashish4112001@gmail.com> 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.

\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]\{2,4\}\b

Maybe all of the backslashes have to be doubled.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: email extraction in emacs
  2006-12-01  7:37   ` B. T. Raven
@ 2006-12-01 12:20     ` Mathias Dahl
  0 siblings, 0 replies; 7+ messages in thread
From: Mathias Dahl @ 2006-12-01 12:20 UTC (permalink / raw)


"B. T. Raven" <ecinmn@alcisp.com> writes:

>> (defun blah ()
>>  (let (adresses)
>>   (while (search-forward-regexp "\\(REGEXP-MATCHING-EMAILS\\)" nil t)
>>    (setq addresses (append adresses (list (match-string 1)))))
>>   adresses)
>>

> 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.

Yes, there were typos in the code. There should be only one variable,
`addresses'.

> \b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]\{2,4\}\b
>
> Maybe all of the backslashes have to be doubled.

If they are in a string, yes.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-12-01 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-29 16:53 email extraction in emacs a
2006-11-29 17:45 ` Leo
2006-11-29 17:49 ` Peter Dyballa
2006-11-30 13:01 ` Mathias Dahl
2006-12-01  7:37   ` B. T. Raven
2006-12-01 12:20     ` Mathias Dahl
2006-11-30 19:54 ` martin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.