in reply to Regex required to Replace the array specifiers in a string
This will remove parenthesised groups, starting from the innermostuse strict; use warnings; my $string="TestVar(Test1->(xy))->Var2(Test2(10)(12))->Finalvar"; while ($string=~s/ # repeat while we make matches \( #beginning of a parenthesised group [^)(]+ # non parentheses charaters \) # end of group //gx) {} print "$string\n";
Edit: tidied up comments in code block
|
|---|