Add check for regex match object being None.