$re = '/^((?!1|2|12|34).)*$/m';
$str = '0 ABCD
1 EFGH
2 IJKL
3 MNOP
4 ABCD
5 EFGH
6 IJKL
7 MNOP
8 ABCD
9 EFGH
10 IJKL
11 MNOP
12 ABCD
13 ABCD
...
AB 1 CD
...
31 EFGH
32 ABCD
33 ABCD
34 ABCD
35 ABCD
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php