title: Python regex AttributeError: 'NoneType' object has no attribute 'group'
body: <p>I use Regex to retrieve certain content from a search box on a webpage with <code>selenium.webDriver</code>.</p>
  
  <pre><code>searchbox = driver.find_element_by_class_name("searchbox")
  searchbox_result = re.match(r"^.*(?=(\())", searchbox).group()
  </code></pre>
  
  <p>The code works as long as the search box returns results that match the Regex.  But if the search box replies with the string <code>"No results"</code> I get error:</p>
  
  <blockquote>
    <p>AttributeError: 'NoneType' object has no attribute 'group'</p>
  </blockquote>
  
  <p>How can I make the script handle the <code>"No results"</code> situation?</p>