preg_replace pains

From: Date: Fri, 28 Jun 2002 01:36:59 +0000
Subject: preg_replace pains
Groups: php.general 
Request: Send a blank email to php-general+get-104248@lists.php.net to get a copy of this message
Hi all, I've been having a wonderful night trying to solve this one, but I'm going to throw in the towel and see if anyone else can shed some light on it. The scenerio is quite simple, I'm parsing some form input from a user and looking for the following: [details].......[/details] where the .... can be any number of characters. All I want to do is remove the whole section, including the [details] part. So far I've got this working: $message = preg_replace("'\[details\].*?'", "", $message); Which manages to find the opening tags (and remove them) but as soon as I try to capture the closing tag (and all inbetween) it goes horribly wrong. My last attempt looked like this: $message = preg_replace("'\[details\].*?\[/details\]'", "", $message); This fails miserably. I'm fresh out of ideas and don't know enough about regular expressions to be able to complete this task without some assistance. ANY comments welcome! Cheers, Richard

« previous php.general (#104248) next »