I've got a wordpress shortcode which consists of another shortcodes within it. Once the first shortcode is performed i wish to remove other shortcodes utilizing a regex.
[main_code] [sub_code id='testid']test content[/sub_code] [sub_code id='testid' name='testname']test content[/sub_code] [/main_code]
After i execute the primary_code i wish to filter the sub_code into an assortment and access its characteristics without performing sub_code like a shortcode.
Anybody that has understanding to provide us a option would be highly appriciated.
If you wish to match the interior parts, then I'd advise:
preg_match_all('~\[sub_code([^\[\]]*)]([^\[\]]+)\[/sub_code]~', $content, $result);
[^\[\]] matches any content without square brackets. Therefore it is made certain not one other shortcodes can exist within.