* match regexp to list elements
@ 2010-05-22 15:32 evan
2010-05-22 18:22 ` Andreas Politz
0 siblings, 1 reply; 3+ messages in thread
From: evan @ 2010-05-22 15:32 UTC (permalink / raw)
To: help-gnu-emacs
Hi all, I want to locate all elements of a list that match a regexp.
Say I want to write the function match-list-regexp such as if
my-list = '(a1 b2 a3 b4)
then
(match-list-regexp "a[0-9]" my-list)
should give '(0 2)
I though I could use function string-match but I need a way of
converting the elements of a list into strings. Any ideas?
Thanks.
Evan.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: match regexp to list elements
2010-05-22 15:32 match regexp to list elements evan
@ 2010-05-22 18:22 ` Andreas Politz
2010-05-22 20:09 ` evan
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Politz @ 2010-05-22 18:22 UTC (permalink / raw)
To: help-gnu-emacs
evan <evangelou@gmail.com> writes:
> Hi all, I want to locate all elements of a list that match a regexp.
> Say I want to write the function match-list-regexp such as if
> my-list = '(a1 b2 a3 b4)
> then
> (match-list-regexp "a[0-9]" my-list)
> should give '(0 2)
>
> I though I could use function string-match but I need a way of
> converting the elements of a list into strings. Any ideas?
> Thanks.
> Evan.
- `symbol-name' for symbols (as in your example)
- `(format "%s" object)' for any kind of lisp-object
-ap
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: match regexp to list elements
2010-05-22 18:22 ` Andreas Politz
@ 2010-05-22 20:09 ` evan
0 siblings, 0 replies; 3+ messages in thread
From: evan @ 2010-05-22 20:09 UTC (permalink / raw)
To: help-gnu-emacs
That was very helpful. Thanks.
On May 22, 7:22 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> evan <evange...@gmail.com> writes:
> > Hi all, I want to locate all elements of a list that match a regexp.
> > Say I want to write the function match-list-regexp such as if
> > my-list = '(a1 b2 a3 b4)
> > then
> > (match-list-regexp "a[0-9]" my-list)
> > should give '(0 2)
>
> > I though I could use function string-match but I need a way of
> > converting the elements of a list into strings. Any ideas?
> > Thanks.
> > Evan.
>
> - `symbol-name' for symbols (as in your example)
> - `(format "%s" object)' for any kind of lisp-object
>
> -ap
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-22 20:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 15:32 match regexp to list elements evan
2010-05-22 18:22 ` Andreas Politz
2010-05-22 20:09 ` evan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).