I'm trying to use PHP to do a search on strings inside [code]
and [php]
tags. However i cannot get that to work. Using the same regex on other BB tags I can successfully get a match but not on those tags.
I have this so far:
\[(?:code|php)\](.+?)\[\/(?:code|php)\]
This should match on the following content:
[code]
this should be matched
[/code]
[php]
this should be matched
[/php]
I'm using preg_replace_callback
with an anonymous function but the function doesn't get called on those two tags. It get's called if I change the regex to match other tags but not those two.