Remove sections from string
Posted on 2005-05-01
I have a PHP script which loads a HTML document into a string (called $file). I also have a string named $filter. When the script is run, I would like it to go through $file and edit it appropriatly. Bacically, the html document contains a table with several rows. The script should go to the first <tr> tag and check for $filter between <tr> and the </tr> tag. If $filter is NOT found, then everything between the <tr> and the </tr> should be removed from the string. The script then goes to the next <tr> and does the same. It does this continually until no <tr> tags remain. It should then echo $file.