1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strip bbcode and contents

Discussion in 'XenForo Development Discussions' started by NixFifty, Aug 15, 2014.

  1. NixFifty

    NixFifty Well-Known Member

    What would be the best way to strip BBCode and their contents from a string?

    Thanks.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    I use this in my add-on:
    PHP:
    $content XenForo_Helper_String::bbCodeStrip($thread['message']);
    $content preg_replace('/\[(attach|media|img|spoiler)\]/siU'''$content);
    $content preg_replace('/^[\t\s]*(\r?\n){2,}/m'''$content);
     
  3. NixFifty

    NixFifty Well-Known Member

    Perfect, thanks Brogan. :love:
     

Share This Page