bbcode

PHP - BBCode parser - recursive [quote] with regex and preg_replace

hello, i'm making my own bbcode parser, and i've a problem when i try to do the recursive quote. this is my code : function forumBBCode($str){ $format_search=array( '#\[quote=(.*?)\](.*?)\[/quote\]#is' ); $format_replace=array( '<blockquote class="quotearea"><i><a class="lblackbu" href="./index.php?status=userview&userv=$1">$1</a> wr...

How to extract the url+parameters out of a bbcode url tag?

The following code outputs: http://www.google.com http://www.google.com&amp;lang What is the simplest way to change the code so it outputs: http://www.google.com http://www.google.com&amp;lang=en&amp;param2=this&amp;param3=that CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace...

Regular expression convert url to hyperlink

I've googled some code that converts an url into a hyperlink using bbcode The code is : // format the url tags: [url=www.website.com]my site[/url] // becomes: <a href="www.website.com">my site</a> exp = new Regex(@"\[url\=([^\]]+)\]([^\]]+)\[/url\]"); str = exp.Replace(str, "<a href=\"$1\">$2</a>"); // format the img tags: [img]www.web...

bbcode unparser regex help

Hi, I have this function to parse bbcode -> html: $this->text = preg_replace(array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[img\](.*?)\[\/img\]/ms', '/\[email\](.*?)\[\/email\]/ms', '/\[url\="?(.*?)"?\](.*?)\[\/url\]/ms', '/\[size\="?(.*?)"?\](.*?)\[\/size\]/ms', ...

How to add a new BBCODE option to the IPB text editor?

Hi, I just installed Invision Power Board Version 3.1.1 script on a server and I need to add a button on the text editor so that it shows a message box, takes an input, formats it and inserts it in the comment. Much like the image link button. Anyone with IPB experience please comment :) Thanks. ...

How to stop BB Code manipulation?

Hi I recently discovered an issue where people using BB Code to enter links are able to manipulate them. They are meant to enter something like: [LINK]http://www.domain.com[/LINK] However they can enter something like this to make the link color red: [LINK]http://www.domain.com 'span style="color:red;"'[/LINK] This is the code...

How to stop BB Code manipulation (part two)?

I recently discovered an issue where people using BB Code to enter links are able to manipulate them. They are meant to enter something like: [LINK=http://www.domain.com]example text[/LINK] However they can enter something like this to make the link color red: [LINK=http://www.domain.com 'span style="color:red;"']example text[/L...

Except URL regex

Sigh, regex trouble again. I have following in $text: [img]http://www.site.com/logo.jpg[/img] and [url]http://www.site.com[/url] I have regex expression: $text = preg_replace("/(?<!(\[img\]|\[url\]))([http|ftp]+:\/\/)?\S+[^\s.,>)\];'\"!?]\.+[com|ru|net|ua|biz|org]+\/?[^<>\n\r ]+[A-Za-z0-9](?!(\[\/img\]|\[\/url\]))/","there was l...

Removing nested bbcode (quotes) in PHP

Hello, 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 message in the original quote [/quote] A second message quoting the firs...

Regular expression crashes Apache due to PCRE limitations. Need some help optimising!

Hey there. I am currently creating bbcode parsing engine and I have encountered a situation what i can't figure out on my own. The thing is, that I popped into a problem exactly like this one: http://stackoverflow.com/questions/3457039/apache-php-on-windows-crashes-with-regular-expression That means that if i make something like the ex...

How to cut this tag out in php?

I want cut out everything inside (tags included) from text, for ex: [url=http://xxx.com]something[/url] but with one condition, inside of [url] tag there would be [img] tag. So final sentence to cut: [url=http://xxx.com]anything[img]something[/url] can anyone help? im bad with regular expressions, or there is easier way? ...

I can't get the MarkItUp to display bbcode in the preview

I want to use markItUp to allow users to format their text using bbcode, but the preview isn't working. I've downloaded markItUp 1.1.8 from the site and tested this locally. The default behaviour is to use HTML code for formatting, and pressing preview renders the code as html and displays the formatting. I've downloaded the "basic b...

PHP Basic BBcode

Heya! I've managed to successfuly integrate BBCode, but I was wondering say if I wanted to dynamically list all the allowed/accepted BBCode - how would I be able to do that? (as it can be tedious manually writing out...and if the BBCode ever changed I'd have to update the writing) I current have a BBCode() function, which contains 2 ar...

Regex to split BBCode into pieces

str = "some html code [img]......[/img] some html code [img]......[/img]" I want use regex get the array: ["[img]......[/img]","[img]......[/img]"] Any ideas anyone? ...

Why does my JavaCC parser not parse tokens smaller than 2 characters?

I'm working on a JavaCC parser that should parse BBcodes. My Javacc source code: patebin.com (Junit test: here) The source code kind off works, but it does not want to accept tokens with a single character, only multi character strings are recognized. It does parse this string: "test[b]bold[/b]nothing[b]bold[/b]after" But not: "t[b...

How to match optional open/close tags in JavaCC?

What JavaCC syntax does implement grammar that can parse these kind of lines: [b]content[/b] content[/b] [b]content Although the JavaCC parser needs to parse all lines, it must distinguish correct and incorrect tagging behavior. Correct tags are like the 1st line, they have an open and close tag. When the tags are matched this will o...

BB Code issue PHP

Alright so I am using a little bbcode function for a forum I have, working well, so if, in example, I put [b]Text[/b] it will print Text in bold. My issue is, if I have that code: [b] Text[/b] Well it will not work, and just print that as it's right now. Here is an example of the function I am using: function BBCode ($string) { ...

What does BBCODE_TYPE_ROOT mean?

When using PHP's BBCode extension, does anyone know what BBCODE_TYPE_ROOT means exactly? It doesn't seem necessary, at least with this example, however, it is used in most of the examples in the documentation. The documentation is pretty vague about this element: BBCODE_TYPE_ROOT (integer) This BBCode tag is the special tag root (n...

Need a web-embedded editor that doesn't save in HTML

Our clients are able to edit some text on our "admin" web site, which then displays to their customers on another "client" web site. They now want the ability to add mark-up like bold, italic, underline (and combinations of the above) plus links to web pages. Unfortunately, because we use a web framework that passes the stored text thr...

A comparison of markup languages: markdown, markup, wikiformat, restructuredtext,bbcode

This is a collection of markup language comparison, which may cover the below points, please don't close this question. easy to write. easy to read. integration for program languages. convert tools for html/pdf other staffs. ...