Now on day 3 with a gazillion variations I do not get it to work. I have reduced the code to the bare minimum, checked the regex against Rubular (it works there) - still in the code preg_match stubbornly returns zero although it is obvious that 6 digits should find a match in $test:
<?php
$regex = '/^[0-9]{6}$/';
$test = "28 888469 29 571086 dfghjytr 30 888192 31 570472 32 888470 33 888471";
$pos = preg_match($regex, $test, $matches, PREG_OFFSET_CAPTURE);
if (!$pos === 0){
echo "<br>";
print_r($matches);
}else{
echo "not in $test";
}
echo "<br>";
echo 'end program';
?>