RE: [PHP] stripping
| From: | Jack Dempsey | Date: | Thu, 10 Apr 2003 09:07:30 +0000 |
| Subject: | RE: [PHP] stripping | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143287@lists.php.net to get a copy of this message | ||
ok, so i don't have easy access to php at the moment, but here's the code in
perl:
$text =
"alksdjflskjdf<blockquote>thi\nsisljf\nlasjdflajsdflj</blockquote>\nalsjfal;
skjf\n";
print "$text\n\n";
$text =~ s|<blockquote>.*?</blockquote>||gis;
print $text;
so, the important part, the regex, is easy enough to put back into
php...basically, you want it to be case insensitive, repeat as many matches
as possible, and for the . to match \n as well...
try that,
jack
> -----Original Message-----
> From: Sebastian [mailto:sebastian@dslr.net]
> Sent: Thursday, April 10, 2003 3:47 PM
> To: Jack Dempsey; php list
> Subject: Re: [PHP] stripping
>
>
> I tried this:
> $comment = eregi_replace("<blockquote>.*?</blockquote>", "",
> $comment);
>
> Shouldn't it replace everything inside, including <blockquote> tags?
>
> cheers,
> - Sebastian
>
>
> ----- Original Message -----
> From: "Jack Dempsey" <dempsejn@georgetown.edu>
>
>
> | just use a regular expression...do a substitution matching a
> | <blockquote>.*?</blockquote> which is case insensitive and doesn't care
> | about line breaks (m modifier)...use an empty string as replacement...
> |
> | jack
> |
> | > -----Original Message-----
> | > From: Sebastian [mailto:sebastian@dslr.net]
> | > Sent: Thursday, April 10, 2003 1:55 PM
> | > To: php list
> | > Subject: [PHP] stripping
> | >
> | >
> | > Hello,
> | > How could i strip out everything inside the <blockquote></blockquote>
> | > including the <blockquote> as well?
> | >
> | > cheers,
> | > - Sebastian
> | >
> | >
> | > [quote]
> | > [b]some text...[/b]
> | >
> | > <blockquote>
> | > <b>some text...</b>
> | > some more text....
> | > </blockquote>
> | >
> | > some more text....
> | > [/quote]
> | >
> | >
> | >
> | >
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>