Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this function:</p> <pre><code>&lt;?php function bbcode ($bbcode) { $matches = array(); if(preg_match_all ( "/\[list.*\].*\[\/list.*\]/Ui", $bbcode, $matches ) &gt; 0) { $matches = $matches[0]; foreach($matches as $match) { $replace = $match; $replace = preg_replace('/\[list:.*\](.*)\[\/list:.*\]/Ui', '&lt;ul&gt;\1&lt;/ul&gt;', $replace); $replace = preg_replace('/\[list=1:.*\](.*)\[\/list:.*\]/Ui', '&lt;ol&gt;\1&lt;/ol&gt;', $replace); $replace = preg_replace('/\[list=a:.*\](.*)\[\/list:.*\]/Ui', '&lt;ol type="a"&gt;\1&lt;/ol&gt;', $replace); $replace = preg_replace('/\[\*.*\](.*)&lt;br&gt;/Ui', '&lt;li&gt;\1&lt;/li&gt;', $replace); $replace = preg_replace('/&lt;br&gt;/Ui', '&lt;/li&gt;&lt;li&gt;', $replace); $replace = preg_replace('/l\&gt;\&lt;\/li\&gt;/Ui', 'l&gt;', $replace); $replace = preg_replace('/\&lt;li\&gt;\&lt;\//Ui', '&lt;/', $replace); $replace = str_replace('&lt;li&gt;&lt;li&gt;', '&lt;li&gt;', $replace); $bbcode = str_replace($match, $replace, $bbcode); } } $search = array ( "/\n/", //newlines "/\[b:.*\](.*)\[\/b:.*\]/Ui", //bold "/\[i:.*\](.*)\[\/i:.*\]/Ui", //italic "/\[u:.*\](.*)\[\/u:.*\]/Ui", //underline "/\[img:.*\](.*)\[\/img:.*\]/Ui", //images "/\[code:.*\](.*)\[\/code:.*\]/Ui", //code-blocks "/\[url\](.*)\[\/url\]/Ui", //links "/\[url=(.*)\](.*)\[\/url\]/Ui", //links with names "/\[color.*\](.*)\[\/color.*\]/Ui", //color "/\[size.*\](.*)\[\/size.*\]/Ui", //color "/\[quote:[^\]=]*\](.*)\[\/quote[^\]]*\]/i", "/\[quote:[^\]]*=\"([^\"]*)\"\](.*)\[\/quote[^\]]*\]/i", ); $replace = array ( '&lt;br&gt;', '&lt;b&gt;\1&lt;/b&gt;', '&lt;i&gt;\1&lt;/i&gt;', '&lt;u&gt;\1&lt;/u&gt;', '&lt;a href="\1"&gt;\1&lt;/a&gt;', //images to links '&lt;pre&gt;\1&lt;/pre&gt;', '&lt;a href="\1"&gt;\1&lt;/a&gt;', '&lt;a href="\1"&gt;\2&lt;/a&gt;', '\1', '\1', '&lt;blockquote style="border:1px solid black;"&gt;\1&lt;/blockquote&gt;', '&lt;blockquote style="border:1px solid black;"&gt;\1:&lt;br&gt; \2&lt;/blockquote&gt;', ); $count = 0; $bbcode = preg_replace($search, $replace, $bbcode, -1, $count); if($count == 0) return $bbcode; else return bbcode($bbcode); } echo bbcode($bbcode); ?&gt; </code></pre> <p>This should do all the replacements you need :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload