...

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



tylerjca
06-15-2006, 12:44 AM
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
tags.

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



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


Thanks in advance :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum