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
4
votes
1 answer

Using HTMLAgilityPack to convert links into BBCODE?

I have some text and at different positions of this text I have some HTML links such as text. I would like to convert it into [url=link]text[/url]. I know how to read the href, and the text alone, for instance: var link =…
Prix
  • 19,417
  • 15
  • 73
  • 132
3
votes
1 answer

Preg_replace BBCode Link

I have this bbcode: [url=http://www.youtube.com/watch?v=h1bIEK1h150]If I offer you my soul[/url] for example. How can I turn this into this: If I offer you my soul
Ivanka Todorova
  • 9,964
  • 16
  • 66
  • 103
3
votes
3 answers

Regex how to look ahead and see if there is another matching end part?

I am using a regex pattern to find instances of [code][/code] BB tags. (This is in PHP with pearl-type regex using preg_match / preg_relace / etc) '~\[code\](.*?)\[\/code\]~is' Well, my question is how can I make it so somebody could type…
Lakey
  • 1,948
  • 2
  • 17
  • 28
3
votes
8 answers

Regex to strip BBCode

I need a regular expression to strip out any BBCode in a string. I've got the following (and an array with tags): new RegExp('\\[' + tags[index] + '](.*?)\\[/' + tags[index] + ']'); It picks up [tag]this[/tag] just fine, but fails when using…
Oskar Rough
3
votes
3 answers

Free lightweight bbcode editor with jquery

I want a BBCode editor that is/has: Free Lightweight Easily and cleanly install (not so much dependencies) Secure Able to be appended to the page later with jQuery List item Fast
Alireza Noori
  • 14,961
  • 30
  • 95
  • 179
3
votes
1 answer

How do I use regex to convert Slack URLs to BB Code?

I'm trying to use regex to convert Slack's version of markdown formatting to BB Code. I'm stuck on links at the moment. Slack formats like this: BB Code formats like this: [url=www.url.com]This is…
David
  • 169
  • 3
  • 13
3
votes
2 answers

Recursive BBCode Parsing

I'm trying to parse BBCode in my script. Now, it works seamelessly, until I try to indent BBCode that's more than just bold or underline - such as spoiler, url, font size, etc. - then it screws up. Here's my code: function parse_bbcode($text) { …
casraf
  • 21,085
  • 9
  • 56
  • 91
3
votes
3 answers

How can I combine two (or more) preg_replace's - PHP

< EDIT > I Wanted to give a big thank you to all of you who have provided an answer, You have all given me great options. I will play with each and see which one suits my exact needs prior to selecting an answer. I do appreciate all of your…
DrCustUmz
  • 77
  • 7
3
votes
2 answers

Adding a new element HERE where the code is, not after another element

Made some BBcode for phpBB to allow users to post flickr pics with certain tags. Each photo div in the thread needs to be unique, and the images load when the thread is loaded. When it comes to the unique DIV, I'm stuck for a way to insert the…
digitaltoast
  • 659
  • 7
  • 23
3
votes
1 answer

Tinymce - problem with fontsize using bbcodes

i am using tinymce with the bbcodes-plugin. In generally, its working nicely, most of the bbcodes like [b] and [color] and so forth are transmitted into html within the textarea and safed as bbcodes into the database correctly. The thing with…
maschek
  • 31
  • 2
3
votes
4 answers

PHP BBcode using preg_replace() - Prevent users from entering onClick, onKeyPress

I have a simple question (not for me), ok, at first, please take a look at this: $msg=preg_replace("/\[b(.*?)\](.*?)\[\/b\]/i", "$2", $msg); Okay, on that regEXP, a $msg will replace any thing found and put it into a new form (I don't…
xx3004
  • 760
  • 2
  • 11
  • 20
3
votes
2 answers

Allow users to post BBCode or HTML with WYSIWYG?

I've been updating a members page system and one of the requirements is to allow bold, underline, italic, font colour and links on certain fields but not font size or style - all this with a WYSIWYG editor. This was originally done with a textarea…
Dunhamzzz
  • 14,682
  • 4
  • 50
  • 74
3
votes
2 answers

Replace [b]xxx[/b] with 'xxx' in bold

How can I convert [b]xxx[/b] to xxx using VB.NET Regex.Replace()? Thanks.
Curtis
  • 101,612
  • 66
  • 270
  • 352
3
votes
2 answers

Removing nested bbcode (quotes) in PHP

I'm trying to remove nested quoting from my bulletin board, but I'm having some issues. Example input: [quote author=personX link=topic=12.msg1910#msg1910 date=1282745641] [quote author=PersonY link=topic=12.msg1795#msg1795 date=1282727068] The…
Kevin
  • 31
  • 4
3
votes
2 answers

bbcode doesn't work when i add online jquery library in footer

first time using stackoverflow.. so sorry for being confusing here. I just implemented bbcode on my bootstrap webpage. it all works as i want it too, but when that works, my navigation doesn't work. When i add this :
1 2
3
40 41