- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$string = "001122334 001122334455 0011 0011223344556677";
if (preg_match_all('/\b[a-fA-F0-9]{12}\b/', $string, $matches)) {
print_r($matches[0]);
}
if (preg_match_all('/(?<!\S)[a-fA-F0-9]{12}(?!\S)/', $string, $matches)) {
print_r($matches[0]);
}
if (preg_match_all('/(?<![a-fA-F0-9])[a-fA-F0-9]{12}(?![a-fA-F0-9])/', $string, $matches)) {
print_r($matches[0]);
}