- is_numeric: documentation ( source)
- preg_match: documentation ( source)
<?php
$string = 'somenametofind|alinktoimages_icon_047_00.png|some-text';
$searched = array("some-text", "047");
foreach ($searched as $s) {
$b = is_numeric($s) ? '\D' : '\b';
if (preg_match("/$b$s$b/i", $string) ) {
echo "found $s\n";
}
}