Preg_match_all
Posted: Tue May 01, 2007 5:06 am
I use preg_match_all to extract content from a html-file, like this:
preg_match_all('#<tr><td class="felt">(.*?)</td><td>#s', $content, $matches);
print_r($matches);
This extract all text inside the table-cells, and this work perfectly!
It return one index of an array like this:
[0] => Postgraduate<br/>
As you see, this index 0 consist of text and a tag.
Sometimes there is additional tag's inside a table-cell defined in the preg_match_all line above...
How can I remove this extra tag, it is mostly a break-tag, but sometime a p-element.
Any tips??
preg_match_all('#<tr><td class="felt">(.*?)</td><td>#s', $content, $matches);
print_r($matches);
This extract all text inside the table-cells, and this work perfectly!
It return one index of an array like this:
[0] => Postgraduate<br/>
As you see, this index 0 consist of text and a tag.
Sometimes there is additional tag's inside a table-cell defined in the preg_match_all line above...
How can I remove this extra tag, it is mostly a break-tag, but sometime a p-element.
Any tips??