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] 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. 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 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
Archived
This topic is now archived and is closed to further replies.