Move re.search to try block for safety.