bbcode

Matching nested [quote] in using RegExp

核能气质少年 提交于 2019-12-25 04:51:57
问题 I'm trying to get regexp to match some nested tags. (Yes I know I should use a parser, but my input will be correct). Example: Text. More text. [quote] First quote [quote] Nested second quote. [/quote] [/quote] Let's say I want the regexp to simply change the tags to <blockquote> : Text. More text. <blockquote> First quote <blockquote> Nested second quote. </blockquote> </blockquote> How would I do this, matching both opening and closing tags at the same time? 回答1: You can't match

Re-enabling Quotes in phpBB Color Code

断了今生、忘了曾经 提交于 2019-12-25 03:22:27
问题 In one of their updates, phpBB removed the option for the [color=value]...[/color] BBCode to include quotes around the color value. My implementation of phpBB depends heavily on this functionality working, since industry software has been designed to output with quotes around the value. How can I re-enable this format? I have tried modifying the regular expressions in includes/message_parser.php to include the possibility of quotes (as shown below). This works for most symbols, but it seems

Ruby regex for stripping BBCode

久未见 提交于 2019-12-25 02:57:45
问题 I'm trying to remove BBCode from a given string (just using gsub with some regex). Here's an example string: The [b]quick[/b] brown [url=http://example.com]fox[/url] jumps over the lazy dog [img=http://example.com/lazy_dog.png] And what I need that to output is: The quick brown fox jumps over the lazy dog So what's a way to do that? I've found various examples of doing this, but none have worked for my use case. One that I've tried: /\[(\w+)[^w]*?](.*?)\[\/\1]/ But that wouldn't catch the

Show bbcode in html page with php

这一生的挚爱 提交于 2019-12-24 17:28:09
问题 I already a bbcode string $mybbcode = [b]Hello word[/b] with php i want to show it with html format in html page. ex: < div><b>hello word</b><div> 回答1: Basically that others already said to you after, but if you search in Google you'll see quicky lot of info about that, and done functions. Here is a sample: function bbc2html($content) { $search = array ( '/(\[b\])(.*?)(\[\/b\])/', '/(\[i\])(.*?)(\[\/i\])/', '/(\[u\])(.*?)(\[\/u\])/', '/(\[ul\])(.*?)(\[\/ul\])/', '/(\[li\])(.*?)(\[\/li\])/', '

Convert BBCode [IMG] to <img>

让人想犯罪 __ 提交于 2019-12-24 02:03:06
问题 I'm using preg_replace to convert all BBCode to HTML but can't get img tags to work. Here is my code: $search = array ( '/(\[b\])(.*?)(\[\/b\])/m', '/(\[i\])(.*?)(\[\/i\])/m', '/(\[u\])(.*?)(\[\/u\])/m', '/(\[ul\])(.*?)(\[\/ul\])/m', '/(\[li\])(.*?)(\[\/li\])/m', '/(\[user=)(.*?)(\])(.*?)(\[\/user\])/m', '/(\[url=)(.*?)(\])(.*?)(\[\/url\])/m', '/(\[url\])(.*?)(\[\/url\])/m', '/(\[img=)(.*?)(\])(.*?)(\[\/img\])/m', '/(\[quote\])(.*?)(\[\/quote\])/m', '/(\[code\])(.*?)(\[\/code\])/m', );

Converting nested html to bbCode quote tags

孤街浪徒 提交于 2019-12-24 00:44:30
问题 I am trying to convert the following html <div class="bbQuote"> <div class="quoteAuthor">Joe Block</div> <div class="quoteContent">This is the first message<br> <div class="bbQuote"> <div class="quoteAuthor">Jane Doe</div> <div class="quoteContent">This is the second message</div> </div> </div> </div> to the following bbCode [quote=Joe Block] This is the first message [quote=Jane Doe] This is the second message [/quote] [/quote] How can I do this using jQuery? PS: Nested HTML can have zero or

Parsing BBCode with xslt 2.0

穿精又带淫゛_ 提交于 2019-12-23 03:35:30
问题 I need help finding a viable solution to convert bbcode to html, this is where ive come so far, but fails when bbcodes get wrapped. Src: [quote id="ohoh81"]asdasda [quote id="ohoh80"]adsad [quote id="ohoh79"]asdad[/quote] [/quote] [/quote] Code: <xsl:variable name="rules"> <code check=" " ><br/></code> <code check="\[(quote)(.*)\]" ><span class="quote"></code> </xsl:variable> <xsl:template match="text()" mode="BBCODE"> <xsl:call-template name="REPLACE_EM_ALL"> <xsl:with-param name="text"

Regex / Preg: No match, if found

一个人想着一个人 提交于 2019-12-20 06:21:37
问题 I'm trying to do some PHP preg. But it seems to i can't get it to match if i want a string without something in it. Example: Hello! My name is [b]Peter Jack[/b] If Peter Jack is found with his last name, it will NOT match, but if its found "[b]Peter[/b]" it will match. Anyone who I'm kinda bad at explaining things, comment if there is anything else you need to help me solve this. Another way I can say it about, is, if i got a link to a website, it will match and do the stuff in the preg

bbcode unparser regex help

孤人 提交于 2019-12-19 04:19:05
问题 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', '/\[youtube\](.*?)\[\/youtube\]/ms', '/\[color\="?(.*?)"?\](.*?)\[\/color\]/ms', '/\[quote](.*?)\[\/quote\]/ms', '/\[list\=(.*?)\](.*?)\[\/list\]/ms', '/\[list\](.*?)\[\/list\]/ms', '/\[\*\]\s?(.*?)

Is there a solid BB code parser for PHP with no dependencies? [closed]

陌路散爱 提交于 2019-12-17 21:11:42
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've got a situation where the client is using php4 and doesn't look like they have PEAR. Is there an established PHP BBCode parser that will work with vBulletin's BBCode system? I just need to convert the BBCode to HTML. This is a data migration from vBulletin to a new platform, so I can't use vBulletin's