title: How to match regex pattern only up to certain character
body: <pre><code>line =abcsdfs?a=name&amp;ab=fsdfsd&amp;c=sfssf
  pattern = '\?a=(.+?)&amp;'
  match_pattern = re.search(pattern, line)
  </code></pre>
  
  <p>I get result as <code>?a=name&amp;</code> and and <code>match_pattern.group(1)</code> as <code>name</code></p>
  
  <p>But if I remove word name I don't get NONE return?</p>
  
  <pre><code>line =abcsdfs?a=&amp;ab=fsdfsd&amp;c=sfssf
  pattern = '\?a=(.+?)&amp;'
  match_pattern = re.search(pattern, line)
  </code></pre>
  
  <p>I get result as <code>?a=&amp;ab=fsdfsd&amp;</code>  and <code>match_pattern.group(1)</code> as <code>&amp;ab=fsdfsd</code></p>
  
  <p>How can I stop it to go further. I mean how to get result None/ error if do <code>match_pattern.group(1)</code></p>