$1'; // Italic $pattern[1] = '/\[i\](.*?)\[\/i\]/is'; $replace[1] = '$1'; // Underlined $pattern[2] = '/\[u\](.*?)\[\/u\]/is'; $replace[2] = '$1'; // Quote $pattern[3] = '/\[quote\](.*?)\[\/quote]/is'; $replace[3] = '
$1
'; // Code $pattern[4] = '/\[code\](.*?)\[\/code\]/is'; $replace[4] = '$1'; // Strikethrough $pattern[16] = '/\[s\](.*?)\[\/s\]/is'; $replace[16] = '$1'; // List Item $pattern[7] = '/\[\*\]([\w\W]+?)\n?(?=(?:(?:\[\*\])|(?:\[\/list\])))/'; $replace[7] = '
  • $1
  • '; // List $pattern[5] = '/\[list\](.*?)\[\/list\]/is'; $replace[5] = ''; // Ordered List $pattern[6] = '/\[list\=(1|A|a|I|i)\](.*?)\[\/list\]/is'; $replace[6] = '
      $2
    '; // Image $pattern[8] = '/\[img\](.*?)\[\/img\]/is'; $replace[8] = ''; // URL $pattern[9] = '/\[url\](.*?)\[\/url\]/is'; $replace[9] = '$1'; // URL (named) $pattern[10] = '/\[url\=([^\[]+?)\](.*?)\[\/url\]/is'; $replace[10] = '$2'; // Font Size $pattern[11] = '/\[size\=([\-\+]?\d+)\](.*?)\[\/size\]/is'; $replace[11] = '$2'; // Font Color $pattern[12] = '/\[color\=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[\/color\]/is'; $replace[12] = '$2'; // YouTube $pattern[9] = '/\[youtube\](.*?)\[\/youtube\]/is'; $replace[9] = ''; $string = preg_replace($pattern, $replace, $string); return $string; }