I'm trying to write a Regular Expression to extract names from an HTML table, where the names are written in the following format: "Smith, Bob"
The regular Expression I'm using is: [a-zA-Z]*,\s[a-zA-Z]*
I keep getting the following error message when executing the code (in the second preg_match_all line): Unknown modifier '*'
I have changed the * to a +, only for the same error prompt. My code is the following:
$start = strpos($content,'<table cellspacing="0" cellpadding="2" rules="all" border="1" id="gvChart"');
$end = strpos($content,'</table>',$start) + 8;
$table = substr($content,$start,$end-$start);
/* Regex */
preg_match_all("|<tr(.*)</tr>|U",$table,$player);
foreach ($player as $val) {
preg_match_all("[a-zA-Z]*,\s[a-zA-Z]*", $table, $name);
echo $name[0];
}
All Help would be much appreciated here, Thanks :)