I am trying to parse a HTML page (see attached file) and I can easily replace several tags with the str_replace but for the more advanced crap such as
LAST_MODIFIED="whatever"
LAST_CHARSET="something"
ADD_DATE="123"
ICON="abc:123456"
I have to use ereg_replace and regular expresssions and now matter how I do it I cant get it right, its so confusing using all those symbols, I spent about an hour already and I'm nowhere
I've tried various variations of this
//open file and read into $bookmarkfile
//convert things into 1 easily findable name
$crap = array(' LAST_MODIFIED=',' ICON=',' ADD_DATE=', ' LAST_CHARSET=');
$bookmarkfile = str_replace($crap, 'DELETE=', $bookmarkfile);
.
.
.
//now in a loop get rid of this stuff
while (strstr($bookmarkfile, 'DELETE='))
{
//can never get this part right
$bookmarkfile = ereg_replace('DELETE=\"([^\"].)+', '', $bookmarkfile );
}
as you can tell, I'm cleaning up my firefox bookmarks :p but regular expressions are making me pull out my hair
(using PHP 4.3.10 on Windows)