Re: how to strip just the <img> tag from html file?
| From: | James Holloway | Date: | Mon, 16 Jul 2001 12:13:16 +0000 |
| Subject: | Re: how to strip just the <img> tag from html file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58038@lists.php.net to get a copy of this message | ||
Hi Shawna
Look up preg_replace();
Assuming $file is the contents of your file -
$file = preg_replace("/<img.*?>/i", "", $file);
James.
<sgibbs@vt.globalhealth.org> wrote in message
news:BB6D932A42D6D211B4AC0090274EBB1D2EEF63@GLOBAL1...
> I've created a "printer-friendly" version of a page (PHP/MySQL) and want
to
> have just the <img> tags automatically removed. I thought about using
> strip_tags() but I'm not able to predict what html tags to include as the
> exceptions so that they would not be removed too. How can I do this?
Thank
> you!
>
> - Shawna
>
>