You can quickly fix the problem by skipping all parts of attribute values that are between angle brackets:
$pattern = '~
\[tabsgroup .*?
title="( (?> <[^>]+> | [^"] )* )" .*?
active="(.*?)"
]
(.*?)
\[/tabsgroup] ~xs';
However, keep in mind that using .*
or .*?
is dangerous and can give you unexpected results, since these subpatterns can match absolutely all. I don't know what are all the possible attributes of your shortcodes, but I suggest to change .*?
by something more explicit. Example:
$pattern = <<<'EOD'
~
\[tabsgroup
\s+ # if you know that it can only be white characters
# otherwise use \s[^]]*?
title="( (?> <[^>]+> | [^"] )* )"
\s+ # the same here
active="([^"]*)" # no quotes allowed here
# or you can reuse the title subpattern: active="((?1))"
# however, if only possible values are 0 and 1: active="([01])"
]
(.*?) # This can be change to ([^[]+) if you are sure to not have
# other tags inside.
# If it is not the case: ( (?>[^[]+|\[(?!/tabsgroup]))* )
# will match all except [/tabsgroup]
\[/tabsgroup]
~xs
EOD;
// Once there is no more dot, don't forget to remove the s modifier