[Coldstuff] match_pattern

Brandon Gillespie coldstuff@cold.org
Wed, 13 Mar 2002 10:21:40 -0700


On Tue, Mar 12, 2002 at 04:35:04PM -0800, Adam Cormany wrote:
> Is there a way to do a match_pattern in a list?
> 
> For example:
> I want to search for "fo*" in ["foo", "fooo", "fuh",
> fui"]

Just iterate the list--there are several ways you could handle it.
first-match, best match, all matches, etc.

Something like (for a first-match iteration):

   for s in (list) {
       if ((m = match_pattern(s, pattern)) {
           return m;
       }
   }

-Brandon Gillespie