doddsey_65 Posted March 9, 2011 Share Posted March 9, 2011 im trying to convert bbcodes into html for a preview but came across a problem. The bbcode is . But within those tags are some <span>s that are used for syntax highlighting. So when i use my current regex it removes those spans: /\[code\](.*?)\[\/code\]/gi <pre><code class="php">$1</code></pre> is there anyway to keep everything between the tags? even the html code? Quote Link to comment https://forums.phpfreaks.com/topic/230108-regex/ Share on other sites More sharing options...
btherl Posted March 9, 2011 Share Posted March 9, 2011 Are you sure it's your regexp removing the html? Try printing your data out using htmlentities() immediately before and after the regexp is applied. Or copy the regexp into a seperate file and use that file for testing it. Quote Link to comment https://forums.phpfreaks.com/topic/230108-regex/#findComment-1185165 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.