ok im totally confused with this regex stuff. Im not really finding a whole lot of places that teach you regex.
But anyways here is what I am trying to accomplish.
I have over 100 .html pages that need content stipped from it and stored into variables so I can manipulate it with php.
There are comments in these .html files that are like this
I need the stuff in between that saved as a variable.Code:<!-- publish type="textbox" name="About Us Content" -->Stuff I need Stripped<!-- /publish -->
All the pages have the same amount of comment tags and these are the exact ones in order:
Here is the php code that I currently have right now. I dont know what to put in the $regex variable.Code:<!-- publish type="textbox" name="About Us Content" --> About Us Stuff That I Need <!-- /publish --> <!-- publish type="textbox" name="Calendar Content" --> Calendar Stuff That I Need <!-- /publish --> <!-- publish type="textbox" name="News Content" --> News Stuff That I Need <!-- /publish -->
It would be really cool if someone could help out..PHP Code:<?php
$url = "http://localhost/pathtofile/etc.htm";
$html = file_get_contents($url);
$regex = "";
preg_match_all($regex, $html, $matches);
foreach($matches[0] as $div) {
echo $div;
}
?>



Reply With Quote
Bookmarks