title: PHP Regex negative look behind assertion, preg_replace_callback
body: <p>I'm working on a script for looping thru PHP files and renaming function calls when necessary. This selection needs to be done by the following rules:</p>
  
  <ul>
  <li>NO function declaration //function test() {</li>
  <li>NO static functions //SomeClass::staticMethod()</li>
  <li>NO class functions // $class->method()</li>
  <li>ONLY function calls // myFunction()</li>
  </ul>
  
  <p>Currently I have the following regex:</p>
  
  <pre><code>preg_replace_callback("/((?&lt;=function\s|\:\:|-&gt;)[a-z][a-zA-Z0-9\_]+)\(.*\)/i", 'test', $content);
  </code></pre>
  
  <ul>
  <li>Function names are mostly written in camelBack notation.</li>
  <li>Sometimes function names contains a underscore.</li>
  </ul>
  
  <p>This is a positive look behind assertion: it gives all the given rules classified by NO :)</p>
  
  <p>So I have to change it in the negative way but that is my problem. When I try, it’s not working as proposed. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>When i try a negative look behind assertion </p>
  
  <blockquote>
    <p><code>'?&lt;!' instead of '?&lt;='</code></p>
  </blockquote>
  
  <p>With the example above it gives the following output: </p>
  
  <ul>
  <li><em>est() (missing first)</em></li>
  <li><em>taticMethod() (missing first)</em></li>
  <li><em>ethod() (missing first)</em></li>
  <li>myFunction() (correct)</li>
  </ul>
  
  <p>It drops the first letter of the functions I don't wanna match. Is there anyone who knows how to do the trick?</p>