php - Best way to parse bbcode -


I want to work on a BBCCC filter for a php website. (I am using the KPPP, it will be a BBCOD subsidiary) I have some requirement

If the BBC can be nested, then something like this is valid. [Block] [block] [/ block] [block] [block] [/ block] [/ block] [/ block]

The BBCode can have 0 or more parameters.

Example:

  [video: url = "url", width = "500", height = "500"] title [/ video] / Code>  

There may be mitiple behavior in BBCOS.

Say, [url] text [/ url] to [url: url = "text"] text [/ url] Or the video will be converted to BBODAd, able to choose between daily motion ....

I think it covers most of my needs I did something with something again but my The biggest problem was to match the parameters. In fact, I was invited to work with BB code and BBM with 0 criteria. But when I added a regex match to the parameters, it did not match correctly with the nested BBCD.

"[[tag] (=. *) \" \] (. *) \ [\ / \ 1 \] " // It was not. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * With rxax or something else The way to match it efficiently. The only thing I can think of is to use the Visitor Pattern and to split my text with every possible tag, there may be some more control over the parsing of my text and I may potentially validate my document, if in input text There is no valid BB code. I can inform the user with an error before saving anything.

I will use sablecc to create my text parser.

Any Is there a better idea? Or anything that can cause a convenient flexible BBCC parser?

Thanks and sorry for my bad english ...

both there and across the BBCOD Sing Library. Difficulties of software without rebuilding your working years.

If n is one of these alternatives, I focus on converting BBCode into a valid XML string, and then using its preferred XML parsing routine on it.

  • Change all too much [and] in & lt; And & gt; [Tag Name:

  • If Bbcd was nested properly, you are ready to pass this string in an XML parsing object (simple XML, doc document, etc.) Should be


    Comments

    Popular posts from this blog

    java - Can't add JTree to JPanel of a JInternalFrame -

    javascript - data.match(var) not working it seems -

    javascript - How can I pause a jQuery .each() loop, while waiting for user input? -