11-28-2007, 10:43 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Nov 2007
Posts: 41
Thanks: 24
|
Need Help with RegEx
I'm trying to code something that parses content the following content:
PHP Code:
<!-- Begin cached content "main" - updated on Mon Nov 26 12:00:01 EST 2007 -->
<div id="maincontent">
<h2>Resources</h2>
<ul>
GRAB THIS CONTENT HERE
</ul>
</div>
<hr id="seperator"/>
<!-- End cached content "main" -->
I'm using this code:
PHP Code:
<?php
$url = "http://www.somewebsite.com";
$data = file_get_contents($url);
$regex = '<!-- Begin cached content (.+?) <!-- End cached content "main" -->';
preg_match($regex,$data,$match);
var_dump($match);
echo $match[1];
?>
Can someone help me fix the regex part so it will grab all the content above?
|
|
|
|