$re = '/^((([0-9]{3}(?![0-9]))|([a-z]{3}(?![a-z])))|(([0-9]{1,2})|([a-z]{1,2}))|-){6,}/im';
$str = '1234as
12as32
09ppdj
ppdj09
12asd3
er123a
123ab2
2dgs23
123as2
asd12a
p23bgf
asdfdw
123432
123asd
ds321a
12asd1
1234aa
a321as
3asr33
V-127-DR 27-09-2017 t/m 26-10-2017 MEER INFO WWW.BELASTINGDIENST.NL
XX-99-99- asda sda
99-99-XX boekeing asdasdasd
99-XX-99 achrijving
XX-99-XX
deze matcht niet XX-XX-99 want het begint niet met een kenteken
99-XX-XX
99-XXX-9
9-XXX-99 dit is een omgschrijving van de belastingdienst
XX-999-X
X-999-XX
XXX-99-X';
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