Re: PHP methods of striping tags and tag contents
| From: | Marek Kilimajer | Date: | Thu, 12 Jun 2003 12:50:39 +0000 |
| Subject: | Re: PHP methods of striping tags and tag contents | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151236@lists.php.net to get a copy of this message | ||
Should be:
$results = preg_replace("@<(tag|tag2)(.*?)>.*?</\\1>@sm","",$html);
Remember you need to find the matching tag, so use backreference.
Burhan Khalid wrote:
Hello dwalker, Thursday, April 24, 2003, 11:50:16 PM, you wrote: Firstly, don't ask for reading confirmation reciepts -- especially on a list. d> What is the most efficient method of removing tags AND the contents between the tags? $results = preg_replace("@<(tag|tag2)(.*?)>.*?</(tag|tag2)>@sm","",$html); were tag|tag2 is the list of tags you want to search for.