Hi all I wish to extract some content from an html file then output the data in two strings for a database. I have managed to extract the data using a regular expression and the html file looks like following. <font color='#660000'>Handbags</font></b> <font color='#660000'>Muppets</font></b> <font color='#660000'>Yellow fish</font></b> <font color='#660000'>Fog Green</font></b> I used preg_match extract the data preg_match_all('/<font color=\"(.*)\">(.*)<\/font>/', $input, $matches); I wish to have an output of Handbags, Muppets (field 1 , field 2) Yellow fish, Fog Green (field 1 , field 2) And not one whole string Handbags Muppets Yellow fish Fog Green Do I have to create a loop for every two arrays matches to split it what would the code be
Thanks for the reply I made a small mistake on the data as i should read <font color="#0000BB">Muppet</font></a></td> <td align="left">Tinbox man</td> <td class="fish"><div>Ginger bread</div></td> preg_match_all('/<font color=\"\#0000bb\">(.*)<\/font>/', $input, $matches); preg_match_all('/<td align=\"left(.*)\"><\/td>/', $input, $person); preg_match_all('/<div>(.*)\">(.*)<\/div>/' ,input, $body); now i did the preg_match and wish to see the ouptut as filed 1, filed 2,filed 3 also could i get the output even no match happens to keep it consistent