<?php
$tests = [
"0000 0000 0000 0000 00/0000 000", // válido
"0000000000000000 00/0000 000", // válido
"00000000 00000000 00/0000 000", // válido
"0000000 000000000 00/0000 000", // inválido: espaços errados
"0000 000 0000 0000 00/0000 000", // inválido: tamanho da sequência errada
"000000000000000 00/0000 000", // inválido: tamanho da sequência errada
];
foreach($tests as $test)
{
if (preg_match("/^((\d{4}\s?){3}\d{4}) (\d{2}\/\d{4}) (\d{3})$/", $test, $matches)) {
}
}
PD9waHAKCiR0ZXN0cyA9IFsKICAiMDAwMCAwMDAwIDAwMDAgMDAwMCAwMC8wMDAwIDAwMCIsICAgLy8gdsOhbGlkbwogICIwMDAwMDAwMDAwMDAwMDAwIDAwLzAwMDAgMDAwIiwgICAgICAvLyB2w6FsaWRvCiAgIjAwMDAwMDAwIDAwMDAwMDAwIDAwLzAwMDAgMDAwIiwgICAgIC8vIHbDoWxpZG8KICAiMDAwMDAwMCAwMDAwMDAwMDAgMDAvMDAwMCAwMDAiLCAgICAgLy8gaW52w6FsaWRvOiBlc3Bhw6dvcyBlcnJhZG9zCiAgIjAwMDAgMDAwIDAwMDAgMDAwMCAwMC8wMDAwIDAwMCIsICAgIC8vIGludsOhbGlkbzogdGFtYW5obyBkYSBzZXF1w6puY2lhIGVycmFkYQogICIwMDAwMDAwMDAwMDAwMDAgMDAvMDAwMCAwMDAiLCAgICAgICAvLyBpbnbDoWxpZG86IHRhbWFuaG8gZGEgc2VxdcOqbmNpYSBlcnJhZGEKXTsKCmZvcmVhY2goJHRlc3RzIGFzICR0ZXN0KQp7CiAgaWYgKHByZWdfbWF0Y2goIi9eKChcZHs0fVxzPyl7M31cZHs0fSkgKFxkezJ9XC9cZHs0fSkgKFxkezN9KSQvIiwgJHRlc3QsICRtYXRjaGVzKSkKICB7CiAgICBwcmludF9yKCRtYXRjaGVzKTsKICB9Cn0=