I managed to find out this solution, it is related to neglecting group() for the situation when the answer in the search string is "No results" and, therefore, does not match Regex.
try: searchbox_result = re.match("^.*(?=(\())", searchbox.group() except AttributeError: searchbox_result = re.match("^.*(?=(\())", searchbox)
or simply:
try: searchbox_result = re.match("^.*(?=(\())", searchbox.group() except: searchbox_result = None
source share