Hi Everyone, What is the best way to extract X Y and Z from the following. <td width="285" valign="top" bgcolor="#FFFFFF"><font class="normal">X<br>Y<br>Z</font></td> Thanks
<?php $in = "<td width=\"285\" valign=\"top\" bgcolor=\"#FFFFFF\"><font class=\"normal\">Heres<br>Your<br>Codes</font></td>"; preg_match("/>(.*)<br>(.*)<br>(.*)<\/font><\/td>/",$in,$out); echo $out[1] . "<br />"; echo $out[2] . "<br />"; echo $out[3] . "<br />"; ?> There ya go mate
Thanks, Ill try that now. I thought preg_match would be the way just couldn't think of the syntax. Thanks again.
preg_match("<font class='normal'>(.*)<br>",$text,$out); What about this to get just X. Warning: preg_match(): Unknown modifier '('
hey dood if you just want X from the string you are doing just use the one i sent you and echo X out with echo $out[1] . "<br />"; ^^ this is wahatever x is you dont need to creat a new code
also wiht preg and match you have to state where you regular expression starts and where it ends , there are several ways to do this but i like the forwerd slash // preg_match("<font class='normal'>(.*)<br>",$text,$out); << URS preg_match("/<font class=\'normal\'>(.*)<br>/is",$text,$out); << MINE the is after the last / slash means > i < for case insencitive and > s < egnore whitespace the baclslash tells the script the your are looking for a literla charactor search for regex cheet sheet for more help with the modifiers Hope this helps you get started mate