Re: grabbing section of file
| From: | Tom Rogers | Date: | Fri, 09 May 2003 17:25:56 +0000 |
| Subject: | Re: grabbing section of file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147044@lists.php.net to get a copy of this message | ||
Hi,
Saturday, May 10, 2003, 2:52:18 AM, you wrote:
BVB> how would I grab just a section of a file, if I had
BVB> <!-- content -->
BVB> Content
BVB> <!-- /content -->
BVB> how could I grab everything between the 2 content comments?
something like this (untested):
$matches = array();
preg_match_all('|\<\!-- content --\>(.*?)\<\!-- /content --\>|is',$string,
$matches);
//see what we have
echo '<pre>';
print_r($matches);
echo '</pre>';
--
regards,
Tom