I would like to capture the match of my regex directly in my if condition. I know it was possible in PHP, but I don't know how to do it in a Pythonic way. So I run it twice and it's not sexy at all...
str = 'Test string 178-126-587-0 with a match'
if re.findall(r'[0-9]{3}-[0-9]{3}-[0-9]{3}-[0-9]', str) != []:
match = re.findall(r'[0-9]{3}-[0-9]{3}-[0-9]{3}-[0-9]', str)[0]