Image

Imagesirstompsalot wrote in Imagephp

I'm writing a little system to highlight PHP and it works like a dream.

$pattern = "/\[PHP\](.*?)\[\/PHP\]/ise";
$replace = "\$this->theboogymancan('$1', 0)";
$content = preg_replace ($pattern, $replace, $content);

However, I've run into a snag.

I'm doing a str_replace to turn smilies (:axe:, ;) and so on) into images. However, if my inside my [PHP] bbCode contains these characters, they get parsed out as well. So I'm essentially looking for

if(!preg_match("/\[PHP\](.*?)\[\/PHP\]/ise", $content))
{
$content = $this->viewHelper->string->convertSmilies();
}

Which I've tried and it doesn't seem to work, as I expected.

So my question to ya'll is: Is there a method to match OUTSIDE bbCode tags, so I don't get string replace inside [PHP] and [/PHP]?

Thanks!

-Shade