Hello! My task is to get one table (from <table ..... to </ table>) from large porridge on html. This table differs from the rest of the mass in that it has the following entry in the opening tag:
class="table01"
Based on this, make up the appropriate template:
'/<table .* class="table01" .*>[\S\s]*<\/table>/Uix'
And in the end I get zero. And even so, even so:
$pregTable = '/<table .*? class="table01" .*?>[\S\s]*?<\/table>/ix';
Here is the code itself:
$file = file_get_contents('test.html'); $pregTable = '/<table .* class="table01" .*>[\S\s]*<\/table>/Uix'; $arrTable = array(); preg_match_all($pregTable, $file, $arrTable, PREG_SET_ORDER); print_r($arrTable);
I tried a lot of different options, I suffer the whole day, nothing comes out. I receive either the text from the beginning of the desired table to the closing of the last - if I do not use it? or the modifier U, or zero - if with them. What am I doing wrong here?