adamminer Posted June 4, 2010 Share Posted June 4, 2010 Basically, I am using a JavaScript texteditor that excessively uses divs, which are showing up in SyntaxHighlighter. My issue is that many people on my site post CSS within [css] tags, but with my knowledge, I either convert all </div><div> into \n, or none of them at all. So how would i convert </div><div> into \n, but only within [css][/css]? Quote Link to comment https://forums.phpfreaks.com/topic/203913-convert-into-n-but-only-within-csscss-tags/ Share on other sites More sharing options...
Adam Posted June 7, 2010 Share Posted June 7, 2010 When you say match "</div><div>", do you mean exactly that? What about white space? preg_replace('/(\[css\].*?)<\/div>\s*<div>(.*?\[\/css\])/s', '$1<br />$2', $str); If you don't want it to match white space between the div tags, just remove "\s*". Quote Link to comment https://forums.phpfreaks.com/topic/203913-convert-into-n-but-only-within-csscss-tags/#findComment-1068898 Share on other sites More sharing options...
adamminer Posted June 13, 2010 Author Share Posted June 13, 2010 Thanks, and no, whitespace doesn't matter, it is just a dirty output by a JS texteditor. Quote Link to comment https://forums.phpfreaks.com/topic/203913-convert-into-n-but-only-within-csscss-tags/#findComment-1071321 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.