Your template \(.*?\) Matches a ( and then finds the first one ) (and everything in between): how did the template “understand” to fit the balanced bracket?
However, you can use a recursive PHP template:
$string = "Hustlin' ((Remix) Album Version (Explicit)) with (a(bbb(ccc)b)a) speed!"; echo preg_replace("/\(([^()]|(?R))*\)/", "", $string) . "\n";
will print:
Hustlin 'with speed!
Short break pattern:
\( # match a '(' ( # start match group 1 [^()] # any char except '(' and ')' | # OR (?R) # match the entire pattern recursively )* # end match group 1 and repeat it zero or more times \) # match a ')'
source share