How to use re match objects in a list comprehension,[m.group(1) for l in lines for m in [regex.search(l)] if m]