View Full Version : regex for no parsing between [code][/code]

06-14-2006, 11:44 PM
I've been trying to figure this out all day..
I hope someone can help me out:confused:

I need a way to make it so certain tags (eg. ) will only parse when they are outside of

I've been playing around with it and everytime I get close, it messes up.
Here's what I have so far...

$regex = '/^(?!\[code\](.*?)\[color=(.*?)\](.*?)\[\/color\]^(?!(.*?)\[\/code\]))/';
$text = preg_replace($rregex,"<span style='color:$2'>$3</span>",$text);

Thanks in advance :)