I have an array with 1000 indexes with random text and random numbers, so I need to get in this text excerpts that are in particular formats containing pre-defined character quantities, such as a string as follows: 65 45 98 12 15 98 17 characters) or 04668475 03/1980 (date format after numeric sequence), how can I create a filter function to pass the indexes through it and just return the strings on the screen that fit those formats?
Informal example:
$strings = array("1" => "12 32 87 98 54", "2" => "154654651", "3" => "1354654654 45 45 45 45 45");
$mascara = ## ## ## ## ##;
$contar = count($strings);
for($i=0; $i < $contar; $i++){
if($mascara == $strings[$i]){
echo $strings[$i]."encontrado";
}else{
echo $strings[$i]."nao encontrado";
}
}
In case the indexes would be compared to the mask and if there is an excerpt of the string with the format of the mask would be printed as found.