There is a known \"pattern\" to get the captured group value or an empty string if no match:
match = re.search(\'regex\', \'text\') if match: value = mat
One liners, one liners... Why can't you write it on 2 lines?
getattr(re.search('regex', 'text'), 'group', lambda x: '')(1)
Your second solution if fine. Make a function from it if you wish. My solution is for demonstrational purposes and it's in no way pythonic.