Ok so I have this regex that I created and it works fine in RegexBuddy but not when I load it into php. Below is an example of it.
Using RegexBuddy I can get it to works with this:
\[code\](.*)\[/code\]
And checking the dot matches newline, I added the case insensitive, but it works that way as well.
Here is the php:
$q = "[code]<div>html code to display on screen</div>[/code]";
$pattern = '/\[code\](.*)\[/code\]/si';
$m = preg_match($pattern, $q, $code);
So you can see I am using [code][/code] and then once I can extract this I will run htmlentities() on it to display instead of render html code.