RegExp is not suitable for an array of patterns
I need to check "If not matching". Does the match work correctly:
<?php
$string1 = 'BB123';
$string2 = 'ZZ123';
$pattern = '/^(AA.*|BB.*|CC.*)$/';
echo preg_match($pattern, $string1);
echo preg_match($pattern, $string2);
I get 1 and 0 and everything is fine. But if you change the template to
$pattern = '/^(?!AA.*|BB.*|CC.*)$/';
I get 00.
Help me get 0 and 1 by changing only the template.
+3
source to share