title: php preg_match positive lookahead not working as expected
body: <pre><code>$regex  = '/(?&lt;=(total: ))(\$\d+\.\d+)/';
  $search = '$1.25 cart total: $24.99 $55.50';
  
  preg_match($regex, $search, $price);
  </code></pre>
  
  <p>I would like to extract '$24.99' from the string above.</p>
  
  <p>When I print_r the $price array, it is blank. According to this tool: <a href="http://regexr.com?2vfm9" rel="nofollow">http://regexr.com?2vfm9</a> my regex should be working correctly. When I run the code using only the "(\$\d+.\d+)" part of regex, the array returns all of the prices... so I know that part is working.</p>
  
  <p>Am I implementing the positive lookahead incorrectly? Any other thoughts?</p>
  
  <hr>
  
  <p>UPDATE:
  I think I might have found the problem:</p>
  
  <p>The text that I am parsing has a "&amp; nbsp;" after the colon. It wasn't showing when I displayed the raw text to myself, but was interfering with the regex. I'll update to confirm.</p>