benslayton
07-19-2008, 10:10 AM
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
<!-- publish type="textbox" name="About Us Content" -->Stuff I need Stripped<!-- /publish -->
I need the stuff in between that saved as a variable.
All the pages have the same amount of comment tags and these are the exact ones in order:
<!-- 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 -->
Here is the php code that I currently have right now. I dont know what to put in the $regex variable.
<?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;
}
?>
It would be really cool if someone could help out..
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
<!-- publish type="textbox" name="About Us Content" -->Stuff I need Stripped<!-- /publish -->
I need the stuff in between that saved as a variable.
All the pages have the same amount of comment tags and these are the exact ones in order:
<!-- 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 -->
Here is the php code that I currently have right now. I dont know what to put in the $regex variable.
<?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;
}
?>
It would be really cool if someone could help out..