RE: [PHP] Stripping specific tags
| From: | John Holmes | Date: | Thu, 19 Sep 2002 23:33:42 +0000 |
| Subject: | RE: [PHP] Stripping specific tags | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116946@lists.php.net to get a copy of this message | ||
> I was wondering is there a way to strip ONLY the tags that you specify
> from
> a page, rather than having to include all the tags you do want (using
> strip_tags() )
A regular expression or str_replace() would be best for this.
Realize this isn't a good method, though. What if you're trying to strip
images with an <img> tag, but a new spec comes out that allows <image>
tags. Now you're not protected against it. That's a simple example, but
it's a better policy to say X is good and allow it through, rather than
to say, I know Y is bad, but I'll let everything else through and assume
it's good.
---John Holmes...