title: Why doesn't this regular expression match in this string?
body: <p>I want to be able to replace a string in a file using regular expressions. But my function isn't finding a match. So I've mocked up a test to replicate what's happening.</p>
  
  <p>I have defined the string I want to replace as follows:</p>
  
  <p><code>string = 'buf = O_strdup("ONE=001&amp;TYPE=PUZZLE&amp;PREFIX=EXPRESS&amp;");'</code></p>
  
  <p>I want to replace the "TYPE=PUZZLE&amp;PREFIX=EXPRESS&amp;" part with something else. NB. the string won't always contain exactly "PUZZLE" and "PREFIX" in the original file, but it will be of that format ).</p>
  
  <p>So first I tried testing that I got the correct match.</p>
  
  <pre><code> obj = re.search(r'TYPE=([\^&amp;]*)\&amp;PREFIX=([\^&amp;]*)\&amp;', string)
   if obj:
      print obj.group()
   else:
      print "No match!!"
  </code></pre>
  
  <p>Thinking that <code>([\^&amp;]*)</code> will match any number of characters that are NOT an ampersand.
  But I always get "No match!!".</p>
  
  <p>However,
  <code>obj = re.search(r'TYPE=([\^&amp;]*)', string)</code></p>
  
  <p>returns me "TYPE="</p>
  
  <p>Why doesn't my first one work?</p>