Skip parsing the BBCode inside the CODE tag

时光总嘲笑我的痴心妄想 提交于 2019-12-02 07:41:46

If you are going to parse from the exterior in, you need something like this for your code tag

(?:\[code])(.*)(?=(?:\[\/code]))

But as other have mentioned, you should be very careful with you do with this because you can not guarantee what is coming to you, it may be malformed and then you will end up with a mess of tags or even an incomplete mixture of parsed and unparsed bbcodes.

Even the code that i just wrote will fail if you have two [/code][/code].

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!