[EMAIL PROTECTED] wrote:

> Hi, I have a list of strings. And I want to find the subset which
> matches a particular regular expression.
> 
> import re
> ll = ('a', 'b', 's1', 's2', '3s')
> p = re.compile('^s.*')
> newList = filter(lambda s: p.match(s), ll)

or

newList = [s for s in ll if p.match(s)]

> I suppose there should be simple function to do this in re module. Is
> there any?

No.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to