DarkendSoul Posted August 28, 2006 Share Posted August 28, 2006 $code = preg_replace("#\[QUOTE\](.*)\[/QUOTE\]#si", "<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'>\\1</td></tr></table>", $code);Using the above code, when inputting things like the following:[ quote] TEXT [ quote] TEXT [ quote] TEXT [ quote] TEXT [/quote] [/quote] [/quote] [/quote]it will only output<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'> TEXT [ quote] TEXT [ quote] TEXT [ quote] TEXT [/quote] [/quote] [/quote] </td></tr></table>I would like to do like it does in this website and output[quote] TEXT [quote] TEXT [quote] TEXT [quote] TEXT [/quote] [/quote] [/quote] [/quote] Quote Link to comment https://forums.phpfreaks.com/topic/18875-preg_replace-bbcode-code-in-code/ Share on other sites More sharing options...
Orio Posted August 28, 2006 Share Posted August 28, 2006 [code]<?phpwhile(preg_match("#\[QUOTE\](.*)\[/QUOTE\]#si", $code)!=0){$code = preg_replace("#\[QUOTE\](.*)\[/QUOTE\]#si", "<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'>\\1</td></tr></table>", $code);}?>[/code]I think this will work :)Orio. Quote Link to comment https://forums.phpfreaks.com/topic/18875-preg_replace-bbcode-code-in-code/#findComment-81502 Share on other sites More sharing options...
DarkendSoul Posted August 28, 2006 Author Share Posted August 28, 2006 thank you. that worked :D Quote Link to comment https://forums.phpfreaks.com/topic/18875-preg_replace-bbcode-code-in-code/#findComment-81809 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.