Re: BB code to XML as application/xhtml+xml
Posted: Tue Aug 18, 2009 10:11 pm
More expressions? Stop reading poetry and join the dark side, we have explosives!
Kidding aside as far as I am concerned it's not a matter of if but when I can achieve a goal!
...though you do have a point, your regex is beautifully short in comparison to my loops and explosions (and it works!)...but I'm just having too much fun blowing things up.
I appreciate that you're trying to do this with regex as an alternative...I want to see my experiment through to the end and see how it holds up against regex as far as much higher iterations of execution are concerned. Plus it never hurts to have two approaches to the same goal. It's very likely that both solutions are more effective depending on the context of how they are applied (say casual talk versus a coding forum in example...not sure, just making something up).
However there are some issues I do have with your regex...actually validity of valid code...sort of. I serve my site as XHTML 1.1 though with your regex I'm not sure how to restrict elements to a white list like how I have been thinking for the past few minutes of how I will implement it in my exploding loop function.
Here is an example of invalid XHTML 1.1...even though it wouldn't break XML it's still invalid...
I think I just thought of a valid application for your regex, pure XML. My example of invalid XHTML would require my solution (and a white list I have yet to implement at this point) however it would be excessive (load wise not sure?) as far as the sheer amount of code if you're working with XML which technically doesn't have any invalid element names as far as I can tell. Maybe you've created a pure XML validator! 
It's sort of nice...I'm not feeling overwhelmed by the challenges...they're coming at a desirable pace.
Ok ok, nearing the end of my day, gotta get at least one more build done! 
Kidding aside as far as I am concerned it's not a matter of if but when I can achieve a goal!
I appreciate that you're trying to do this with regex as an alternative...I want to see my experiment through to the end and see how it holds up against regex as far as much higher iterations of execution are concerned. Plus it never hurts to have two approaches to the same goal. It's very likely that both solutions are more effective depending on the context of how they are applied (say casual talk versus a coding forum in example...not sure, just making something up).
However there are some issues I do have with your regex...actually validity of valid code...sort of. I serve my site as XHTML 1.1 though with your regex I'm not sure how to restrict elements to a white list like how I have been thinking for the past few minutes of how I will implement it in my exploding loop function.
Here is an example of invalid XHTML 1.1...even though it wouldn't break XML it's still invalid...
Code: Select all
echo foo('[jab]bold[/jab]').'<br />';It's sort of nice...I'm not feeling overwhelmed by the challenges...they're coming at a desirable pace.