I need a clean functional preg_replace_callback nested shortcode function that works. i need to parse html identify nested shortcodes (e.g. [widget attr1="foo1" attr="foo2"]*[/widget]) with or without attributes and content. they can be nested up to a depth of 5 max. the pattern i have has problems with the attributes. once a shortcode has atrributes the identifying nest depths breaks somehow. the pattern. ~\[([a-z0-9\_\-\.\:]+)(?:\s+([^]]+))?\]((?:[^|\[(?!/?\\1\])|(?R))*+)\[\/\\1[\s]*\]~isx i can delivery function mockups and specs of what needs to be the capture groups and passed to preg_replace callback function. Looking only for regex guru - no script kiddies!