title: PHP preg_match return false even if condition match
body: <p>I am using <em>preg_match</em> to verify an input :</p>
  
  <pre><code>$string = 'test';
  
  if (preg_match ('/[^-a-z\d]/i', $string))
  {
      return true;
  }
  else
  {
      return false;
  }
  </code></pre>
  
  <p>Well I can not understand why it return <strong>false</strong> here !</p>
  
  <p>Am I missing something ?</p>
  
  <p>Shouldn't it return <strong>true</strong> ?</p>
  
  <p><strong>The solution :</strong></p>
  
  <pre><code>(preg_match ('/^[-a-z\d]*$/i', $string))
  </code></pre>