[Top][All Lists]

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

Re: pattern-identification-data-extraction-format-string

From: Emanuel Berg
Subject: Re: pattern-identification-data-extraction-format-string
Date: Mon, 23 Mar 2015 02:40:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Emanuel Berg <address@hidden> writes:

> Check this out:
>     (car (last (message-tokenize-header "From: Joe
> Hacker <address@hidden>" "<>") )) ; => address@hidden
> Is there a more general way to do that, something
> along the lines of:
>     (pattern-identification-data-extraction-format-string
> "From: Joe Hacker <address@hidden>" ".*<%1>" "This is
> the data I want: %1" )

I was directed to [1], section "Extracting submatches
from a regex match", so I put together

    (let ((header "From: Joe Hacker <address@hidden>"))
        (string-match "<\\(.*\\)>" header)
        (match-string 1 header) )) ; => "address@hidden"

Maybe my original solution to that particular problem
is just as good, but I asked for a generic way and
this seems to be it.


underground experts united

reply via email to

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