Okay use this as an example I want put parse the html document and toss
everything between the two
Div class channels into an array. The problem I am having is that I cannot
grab everything in between the 
Pattern of the preg_match_all.
If I preg_match_all('/<div class="channel" [^<>]*>/i',$document,$elements);
it works perfection
But only arrays the single div statement not everything from div to div. I
think somewhere the syntax of the preg_match_all or the implode that is not
allow this function to work.


Html document
<div class="channel" id="one">
        <div class="title">
        <b>Station Manager</b>
                <div class="topic">Because you Can!
                </div>
        </div>
</div>
<div class="channel" id="two">

Php script
function pullchannel($document)
{
 preg_match_all('/<div class="channel" [^<>]*>(.*)<div class="channel"
[^<>]*>/i',$document,$elements);
$match = implode("\r\n",$elements[0]); 
$match = str_replace('"',"","$match");  
return $match; 
}






-----Original Message-----
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 11, 2007 9:41 PM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all Help

[EMAIL PROTECTED] wrote:
> I have tried this many way  and for some reason
> 
> I cannot pull content between the 2 pattern options.
> 
>  
> 
>  
> 
> function pullchannel($document)
> 
> {
> 
>                 preg_match_all('/<div class="channel" [^<>]*>(.*)<div
> class="channel" [^<>]*>/i',$document,$elements);
> 
> $match = implode("\r\n",$elements[0]);
> 
> $match = str_replace('"',"","$match");
> 
> return $match;
> 
> }
> 
>  
> 
>  
> 
> 
Give us and example of the input data.  And tell us from that example, 
what it is you are expecting to extract from it.

Jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to