eevan79 Posted August 13, 2010 Share Posted August 13, 2010 This is too hard for me and I need some expert opinion if possible. I want to implement multiquote feature with [ quote] [ /quote ] BB tags. I have 2 regex for BBCodes: [ quote = username] and just [ quote] Here is BBCode tags: '/\[ quote\][\r\n]*(.+?)\[\/quote \][\r\n]*/si', '/\[ quote (.+?)\][\r\n]*(.+?)\[\/quote\][\r\n]*/si', and replace: '<div class="quote">\\1</div>', '<div class="quote"><div class="quoting">\\1: </div>\\2</div>', When user click on Quote button (on posts page) I use this preg_replace: $text = preg_replace( '/<div class=\" quote \">(.+?): <\/div>(.+?)<\/div>/is', '[ quote ]\\2[/ quote ]', $text); Note: this codes are without spaces (I must use space to show correct code) To show quoted text in post form I use this: $quoted_text = '[ quote=' . mysql_real_escape_string($_GET['u']) . ']' . $text['post_content'] . '[ /quote]'; (this is in textarea : <textarea>$quoted_text </textarea>) Here is screenshot how it looks like. First two quotes: and third quote have "bugs" Any ideas how to fix multiple quotes? Quote Link to comment https://forums.phpfreaks.com/topic/210676-hard-multi-quote-regex-bbcode/ 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.