desithugg Posted April 24, 2007 Share Posted April 24, 2007 <? function bbcode($replace) { $bbcode = array( "'\[center\](.*?)\[/center\]'is" => "<center>\\1</center>", "'\[left\](.*?)\[/left\]'is" => "<div style='text-align: left;'>\\1</div>", "'\[right\](.*?)\[/right\]'is" => "<div style='text-align: right;'>\\1</div>", "'\[pre\](.*?)\[/pre\]'is" => "<pre>\\1</pre>", "'\[b\](.*?)\[/b\]'is" => "<b>\\1</b>", "'\[quote\](.*?)\[/quote\]'is" => "<div class='top'><b>Quote:</b><hr>\\1</div>", "'\[i\](.*?)\[/i\]'is" => "<i>\\1</i>", "'\[u\](.*?)\[/u\]'is" => "<u>\\1</u>", "'\[s\](.*?)\[/s\]'is" => "<del>\\1</del>", "'\[move\](.*?)\[/move\]'is" => "<marquee>\\1</marquee>", "'\[url\](.*?)\[/url\]'is" => "<a href='\\1' target='_BLANK'>\\1</a>", "'\[url=(.*?)\](.*?)\[/url\]'is" => "<a href=\"\\1\" target=\"_BLANK\">\\2</a>", "'\[img\](.*?)\[/img\]'is" => "<img border=\"0\" src=\"\\1\">", "'\[img=(.*?)\]'" => "<img border=\"0\" src=\"\\1\">", "'\[email\](.*?)\[/email\]'is" => "<a href='mailto: \\1'>\\1</a>", "'\[size=(.*?)\](.*?)\[/size\]'is" => "<span style='font-size: \\1;'>\\2</span></a>", "'\[font=(.*?)\](.*?)\[/font\]'is" => "<span style='font-family: \\1;'>\\2</span></a>", ); $replace = preg_replace(array_keys($bbcode), array_values($bbcode), $replace); return $replace; } ?> Well that's my bbcode function and it works fine no problem with it but I wanted to add a list function where theres bullets are added and the text is done in a list format like below one two thre heres the bb code for it [list] [*]one [*]two [*]threeeeeee [/list] But I'm not so sure how I can preg replace to add bullets to that. Any ideas? Link to comment https://forums.phpfreaks.com/topic/48513-bbcode-preg-replace/ Share on other sites More sharing options...
desithugg Posted April 24, 2007 Author Share Posted April 24, 2007 nvm I got it thanks anyways Link to comment https://forums.phpfreaks.com/topic/48513-bbcode-preg-replace/#findComment-237346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.