0

i have such html code block

 <tr>
   <td style="padding: 11px 8px 11px 15px; color: #000; width: 92px; border-bottom: solid   1px #ccd9e2;"> Name </td>
   <td style="color: #666;border-bottom: solid 1px #ccd9e2;"> Lusine Akopyan </td>
 </tr>

to parse name i use such code preg_match("/Name<\/td>(.+?)<\/td>/is", $html, $match);

but have nothing in $match var, waht i do wrong?

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
Anton Sementsov
  • 1,196
  • 6
  • 18
  • 34
  • Rule 1, don't use regex to parse HTML... Rule 2, if using regex to parse HTML see rule #1 ([Apologies to Marc B for stealing this](http://stackoverflow.com/questions/11525328/auto-p-regex-fix-needed#comment15233746_11525328)) – freefaller Aug 29 '12 at 13:14

1 Answers1

0

Maybe try something like:

preg_match_all("/<td[^>]*>( Name )<\/td>/", $html, $match);

or

preg_match_all("/<td[^>]*>(.*?)<\/td>/", $html, $match);

to get all content within each TD element