I am working on making a bbcode system with php using preg_replace(), and I am making it so that other tags will not work inside of a code block. This is the code I am currently using, it almost works:
/(?!\[code\])(.*)(\[b\])(.+)(\[\/b\])(.*)(?<!\[\/code\])/Usi
what I want it to do is if [*code] and [*/code] are around the text inside, then it won't replace it. But right now it only won't replace when just [*code] is before it.
so I'm trying to check if [*code] OR [*/code] are around it, but not both, then it will go through to be replaced.
Does anyone know how I could go about fixing/doing this?