Menu

#2 [PATCH] code-tag parsing breaks regular expressions (assumes fixed set of groups)

Fixed
nobody
None
Medium
Defect
2012-01-22
2011-12-05
Anonymous
No

Originally created by: lohma...@googlemail.com
Originally owned by: andow...@gmail.com

What steps will reproduce the problem?
1. Extend the code related regular expressions in bb_config.xml
2. get various kinds of java-exceptions when trying to use code-tags in your posts

What is the expected output? What do you see instead?
I expect the regular expression to be applied at it is written, that I can use arbitrary groups and corresponding references

What version of the product are you using? On what operating system?
jforum-2.3.3

Please provide any additional information below.
Attached patch fixes the problem by not trying to distinguish between only two possible variants of the code-tag, instead use a generic match and do the content processing, then apply the regular expressions like for the other bb-tags.

This then allows to use expressions like
         <match name="code">
                <regex>(?s)\[code(?:;((?:\d+,?)+))?\](.*?)\[/code\]</regex>
                <replace>
                <![CDATA[
                <pre name="code" class="brush: java; highlight:[$1]">$2</pre>
                ]]>
                </replace>
        </match>

i.e. ones that don't have the content at group#1 (but at #2 in the example)

1 Attachments

Related

Tickets: #11
Tickets: #50
Wiki: NewFeatures234

Discussion

  • Anonymous

    Anonymous - 2012-01-21

    Originally posted by: andow...@gmail.com

    (No comment was entered for this change.)

    Status: Accepted

     
  • Anonymous

    Anonymous - 2012-01-22

    Originally posted by: andow...@gmail.com

    (No comment was entered for this change.)

    Owner: andow...@gmail.com
    Status: Started

     
  • Anonymous

    Anonymous - 2012-01-22

    Originally posted by: andow...@gmail.com

    (No comment was entered for this change.)

    Status: Fixed

     

Log in to post a comment.