in reply to Regexp for Match Brackets
This counts up the number of '(' and the number of ')' and prints $text if the counts equal.use strict; my $text='(one dfd(two(three)four()(five)df())df)'; print $text if (my @x = $text =~ m/\(/g) == (my @y = $text =~ m/\)/g);
|
|---|