Re: i some more help on the whole ereg thingy please
| From: | lallous | Date: | Fri, 16 Aug 2002 09:11:15 +0000 |
| Subject: | Re: i some more help on the whole ereg thingy please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112924@lists.php.net to get a copy of this message | ||
preg_match('!<div class=Section1[^>]+>(.*)</div>!Uis',$str,$regs[1]);
$everything_between_divs = $regs[1];
when calling preg_match just pass $regs as param and not $regs[1]
Elias
<victor@argilent.com> wrote in message
news:000101c244c9$08401d50$86a96518@jumpy...
> Hi, I hope you can help me a bit more, this is is my current script:
> (look after for more messages)
>
> <?php
> $file_name = $page_name.$ext
> or die ('Error 2');
>
> $file = file($path.$file_name)
> or die ('Error 3');
>
> $str = implode(' ', $file)
> or die ('Error 4');
>
> // This is to check if the above code works
> // echo $str;
> // End check
>
> // Original first tag from the document I need to parse
> // <div class=Section1>
> // Original last tag
> // </div>
>
> preg_match('!<div class=Section1[^>]+>(.*)</div>!Uis',$str,$regs[1]);
> $everything_between_divs = $regs[1];
>
> //echo $everything_between_divs;
>
> $good = implode(' ', $regs)
> or die ('Error 5');
>
> // This is for later use to edit the contents of stuff between
> // the div tags - if I get the div tags to ever work
> $clean = ereg_replace("<o:p></o:p>", " ", $good);
> echo $clean;
> ?>
>
> it doesn't work, what do you think I'm doing wrong?
>
> I get this error:
>
> Notice: Undefined offset: 1 in
> /home/victor/argilent-www/sites/malibu_place_2/index.php on line 104
>
> Warning: Bad arguments to implode() in
> /home/victor/argilent-www/sites/malibu_place_2/index.php on line 106
> Error 5
>
> Thanks,
>
> - Vic
>
>
>
> ______________________________________________________________________
> Post your ad for free now! http://personals.yahoo.ca