// [align]
data = data.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');
+ // search for [*] not preceeded by [list by searching for the first occurence of [list and then check the left
+ var $firstList = data.indexOf('[list');
+ if ($firstList > 0) {
+ var $tmp = data.substr(0, $firstList);
+ $tmp = $tmp.replace(/\[\*\]/g, '');
+ data = $tmp + data.substr($firstList);
+ }
+
+ // search for [*] not followed by [/list]
+ var $lastList = data.indexOf('[/list]');
+ if ($lastList === -1) {
+ // drop all [list*] and [*]
+ data = data.replace(/\[\*\]/g, '');
+ data = data.replace(/\[list[^\]]*\]/g, '');
+ }
+ else {
+ var $tmp = data.substr($lastList + 7);
+ $tmp = $tmp.replace(/\[\*\]/g, '');
+ data = data.substr(0, $lastList + 7) + $tmp;
+ }
+
// [*]
data = data.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi, function(match, content) {
return '<li>' + $.trim(content) + '</li>';