Questions tagged [bbcode]

Bulletin Board Code is a lightweight markup language used to format posts in many message boards. There is no "standard" set of BBCodes, but they are typically parsed into other markup languages.

BBCode or Bulletin Board Code is a lightweight markup language used to format posts in many message boards. The available tags are usually indicated by square brackets ([ ]) surrounding a keyword, and they are parsed by the message board system before being translated into markup languages such as HTML.

Unlike SGML-based markup languages, tags in BBCode do not have attributes. Instead, they may have a single parameter attached to them with the equals sign as a separator, such as the "color" tag on phpBB boards, where [color=red] would make red text, for example.

Common tags include:

  • [b] which makes bold text*
  • [i] which makes italic text*
  • [u] which makes underlined text*
  • [s] which makes strikethrough
  • [quote] which makes a block-level quote box of another post*
  • [color] which takes a color parameter and makes colored text*
  • [code] which creates a code block, inside which BBCodes are typically not parsed*
  • [img] which embeds an image inline*
  • [url] which creates a link to a specified location*
  • [spoiler] which creates a button to show/hide contained text
  • [background] which highlights text

* available by default in phpBB 3.0

611 questions
3
votes
3 answers

Regex & BBCode - Perfecting Nested Quote

I'm working on some BBcode for my website. I've managed to get most of the codes working perfectly, however the [QUOTE] tag is giving me some grief. When I get something like this: [QUOTE=1] [QUOTE=2] This is a quote from someone…
Moe
  • 1,469
  • 3
  • 11
  • 9
3
votes
2 answers

Javascript BBCode Parser recognizes only first list element

I have a really simple Javascript BBCode Parser for client-side live preview (don't want to use Ajax for that). The problem ist, this parser only recognizes the first list element: function bbcode_parser(str) { search = new Array( …
Christian Strang
  • 8,470
  • 5
  • 42
  • 53
3
votes
3 answers

Regex for removing a specific BBCode from a string

I'm trying to write a simple method for removing specific BBCodes from an input string. For example, where I have an input of: string input = "[b]Hello World![/b]"; I would want to be able to do: Remove(input, "b"); And get an output of: "Hello…
Vesuvian
  • 697
  • 1
  • 7
  • 22
3
votes
0 answers

How to use BBcode syntax highlighting in Sublime Text

I have searched through the Sublime Text packages and can't seem to find a BBCode syntax highlighting package. I tried a couple for BBcode syntax which work great, but they don't use syntax highlighting. I currently use IPS BBCode and Color…
Tac
  • 77
  • 7
3
votes
0 answers

TinyMCE not changin list items to BBCODE

I have set the TinyMCE to write everything in BBcode which works on everything except list items. TinyMCE puts out:
  • text
But is should be: [list] [*]text [/list] I use TinyMCE version 4.0b3. My TinyMCE…
Olof
  • 776
  • 2
  • 14
  • 33
3
votes
2 answers

PHP Regex: removing whitespace after specific pattern

Comments below showed me that there was a functionality bug in my code. The question was updated to match. So I have a regex that finds bb style quote and replaces them with a blockquote. $text = preg_replace("/\[quote(?:=\"(\w+?)\")?]/",…
Rohit
  • 3,018
  • 2
  • 29
  • 58
3
votes
3 answers

BBCode for Ruby on Rails

So I'm putting together a simple forum. I'd like to allow my users limited formatting options and BBCode would be plenty for my users. Knowing that I'm assuredly not the first one to want to use BBCode with RoR I googled but couldn't find a straight…
Drew
  • 15,158
  • 17
  • 68
  • 77
3
votes
1 answer

jBBCode - BBcode to html

What I'm trying to do I'm trying to use jBBCode to parse and de-parse bbcode into and from html. The problem When trying to get the html and turn that back in to bbcode, it just displays html. Here is the code I'm using to try and switch html back…
Rai
  • 138
  • 1
  • 9
3
votes
1 answer

Does a Delphi implementation of a BBCode parser exist?

I'm looking for a BBCode library for Delphi, that can translate BBCode into HTML. And it would be nice to have an actual parser that understands the state of the input and is able to detect errors, not something cheap along the lines of: text :=…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
3
votes
0 answers

nbbc code parser - disable all bbcodes inside code tag

I'm using nbbc parser for bbcode tags. I only want to ignore all tags code inside [code] and [/code] elements. The demo is here : http://nbbc.sourceforge.net/full_example.php And the home page is here : http://nbbc.sourceforge.net You can try usibg…
3
votes
1 answer

Security with IMG and URL bbcodes

I'm facing some difficulties when parsing bbcode safely, specifically [img] and [url]. Language is less important, but this is regarding JavaScript.) URLs: Not long ago users were able to write [url=#" onclick="alert('test');"]Link[/url] on my…
lawls
  • 1,498
  • 3
  • 19
  • 34
3
votes
1 answer

PECL bbcode package fails to build

I was running PHP5.3 on Debian Squeeze and the install went fine. I upgraded to PHP5.4 using the dotdeb repository and discovered bbcode functions no longer worked. I then tried to reinstall: pecl uninstall bbcode pecl install bbcode however it's…
Flyn San
  • 1,556
  • 2
  • 13
  • 13
3
votes
2 answers

Url regex for preg_replace but without matching the urls within the bbcode [url]

im making a comment section on a website. At first I needed to do a regular expression that finds any url and replace it surrounded with So I found a super regular expression to find all the url's in a comment and I did a…
Tomás
  • 3,501
  • 3
  • 21
  • 38
2
votes
2 answers

javascript replace() multiple bbcode instances with multiple html

I need to get the javascript replace() function to replace every instance of a [b] or [/b] with or . I tried this with the global tag but it doesn't work and comes out…
Elizabeth
  • 173
  • 3
  • 14
2
votes
3 answers

Parse bbcode youtube tag in text and replace with html including the video id

I'm building a blog that should parse bbcode tags like this: Input: Output:
bloudermilk
  • 17,820
  • 15
  • 68
  • 98