What you want is a negative view , and the syntax is:
if (preg_match('#^(?!Mozilla).#', $agent)) {
In fact, you might just be able to #^(?!Mozilla)# for this. I don’t know how PHP will think of a template that has nothing but zero width markers, but I tested it in JavaScript and it works fine .
Edit:
If you want to make sure that Mozilla does not appear anywhere on the line, you can use this ...
if (preg_match('#^((?!Mozilla).)*$#', $agent)) {
... but only if you cannot use it!
if (strpos($agent, 'Mozilla') !== false) {
Justin morgan
source share