leoluk leoluk - 2 months ago 9
Python Question

Regular Expressions: Search in list

I want to filter strings in a list based on a regular expression.

Is there something better than

[x for x in list if r.match(x)]
?

Answer
filter(r.match, list)