title: Preg match if not
body: <p>Is it possible to do a <a href="https://www.php.net/manual/en/function.preg-match.php" rel="nofollow noreferrer">preg_match()</a> on something that shouldn't be a match whilst still returning true?</p>
  <p>For example, at the moment we have...</p>
  <pre><code>if (preg_match('#^Mozilla(.*)#', $agent)) {
  </code></pre>
  <p>We want to check if the Mozilla string is not in $agent, but still have <code>preg_match</code> return true.</p>
  <p>We can't change it to:</p>
  <pre><code>if (!preg_match('#^Mozilla(.*)#', $agent)) {
  </code></pre>