PCRE - catching a caracter set in a negative class

From: Date: Wed, 10 Apr 2002 01:48:42 +0000
Subject: PCRE - catching a caracter set in a negative class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92325@lists.php.net to get a copy of this message
Hi all, I was scratching my head to accomplish the following perl regular expression. It doesn't want to catch me [^\{php}]. From what I understood reading the docs this is because in a negative class the caracters are being taken litteraly one by one and not as a set. I tied to enclose them by () by that didn't work eigher. What is the work around for this? here's a sample code: $text = ' some text ... {php} echo "some funcy code to include he{re"; {/php} more text.... '; $out = preg_split("/(\{php}[^\{php}]*\{\/php})/i", $text, -1, PREG_SPLIT_DELIM_CAPTURE); Thanks, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com maxim@phpbeginner.com

« previous php.general (#92325) next »