Wouldn't you want to use preg_match() before you replace it? www.php.net/preg_match
---John Holmes... > -----Original Message----- > From: Richard Davey [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 27, 2002 9:37 PM > To: [EMAIL PROTECTED] > Subject: [PHP] preg_replace pains > > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php