I want a regular expression to extract the title from a HTML page. Currently I have this:
title = re.search(\'.*\', html, re.IGNOR
The provided pieces of code do not cope with Exceptions May I suggest
Exceptions
getattr(re.search(r"(.*)", s, re.IGNORECASE), 'groups', lambda:[u""])()[0]
This returns an empty string by default if the pattern has not been found, or the first match.