[wp-hackers] Shortcode parser

Michał Środek michal at srodek.info
Thu Nov 10 12:15:40 UTC 2011

Hey there,

I'm new here and I'd like to fix some core bugs of WP. The first
issues are connected with Shortcode API.

I found some pretty old bugs in trac:

Someone else was writing a shortcodes patch about year ago(you can
read about it here: http://core.trac.wordpress.org/ticket/14481 ) but
his solution wasn't elegant and compatible with already written wp

I've been preparing a fix which will be work great with wp shortcode
interface but I need some unit tests to check my solution.

The first test php file( not so perfect yet ) is available here:
You can also run it online here

Let me know what are you thinking about that. Maybe some of my tests
are incorrect.

The main change is the regular expression which I used. It's much more
precisly because of using recursion. Let me know if you see any bugs
in that regexp.

$regexp = '#(.?)(?:\[('.$tagregexp.')((?:\s|=).*[^\/\]]{1})?\] ( (?:
(?(R) [^\[]++ | [^\[]*+) | (?R)) *) \[/\\2\] |

Warm Regards
Michał Środek

More information about the wp-hackers mailing list