fork(1) download
  1. <?php
  2.  
  3. $html = '
  4. <table>
  5. <td>Any html <span>code</span> this</td>
  6. <td class="нужно получить меня">Any html <span>code</span> this</td>
  7. </tr>
  8. <tr>
  9. <td>Any html <span>code</span> this</td>
  10. <td class="нужно получить меня">Any html <span>code</span> this</td>
  11. </tr>
  12. <tr>
  13. <td>Any html <span>code</span> this</td>
  14. <td class="нужно получить меня">Any html <span>code</span> this</td>
  15. </tr>
  16. </table>
  17. ';
  18.  
  19. $pat = '/<td.*?>.*?<\/td.*?>/si';
  20. preg_match_all($pat, $html, $kx1);
  21.  
  22. var_dump($kx1);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
array(1) {
  [0]=>
  array(6) {
    [0]=>
    string(40) "<td>Any html <span>code</span> this</td>"
    [1]=>
    string(85) "<td class="нужно получить меня">Any html <span>code</span> this</td>"
    [2]=>
    string(40) "<td>Any html <span>code</span> this</td>"
    [3]=>
    string(85) "<td class="нужно получить меня">Any html <span>code</span> this</td>"
    [4]=>
    string(40) "<td>Any html <span>code</span> this</td>"
    [5]=>
    string(85) "<td class="нужно получить меня">Any html <span>code</span> this</td>"
  }
}