[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: match regexp to list elements
From: |
Andreas Politz |
Subject: |
Re: match regexp to list elements |
Date: |
Wed, 08 Dec 2010 15:09:37 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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