- preg_match_all: documentation ( source)
<?php
$FileContent = 'Bot draws - nino: (JH)';
preg_match_all("#^Bot draws - ([a-z0-9\-\._]+)\: ?(\((.*)\))?$#i",$FileContent,$Matches);
if ( is_array($Matches) && isset($Matches[0]) && count($Matches[0]) > 0 ) {
foreach ( $Matches[0] as $key=>$val ) {
$$Matches[1][$key] = create_function($Matches[2][$key],$Matches[3][$key]);
}
}
echo $Matches;