Too much to cover here, but check out pages 328-331 of "Mastering Regular Expressions, 2nd Edition" by J. Friedl. It provides a techique to do that using a Dynamic RegEx in perl.
Brief synopsis of theory of solution:
1. Define variables that represent a RegEx for a matched pair. One variable for each nest expected.
2. Include the variable for each nest in each following nest variable.
Example:
my $Level0 = qr/ \( ( [^()] )* \) /x; # paranthesized text
my $Level1 = qr/ \( ( [^()] $Level0 )* \) /x; #one level of nesting
my $Level2 = qr/ \( ( [^()] $Level1 )* \) /x; #two levels of nesting
my $Level3 = qr/ \( ( [^()] $Level2 )* \) /x; #three levels of nesting
.....
.....
my $LevelN = .......... #N levels of nesting
This concept means it could be unlimited by including itself resulting in:
my $LevelN; #must predeclare since it is called in its own expression.
my $LevelN = qr/ \( ( [^()] | (??{ $LevelN })* \) /x;
And by using If statements, you can make this work if there MAY be nested groups vs. if the ARE nested groups.
You could jump right to the end of the explanation on page 331, but I think it is important to understand what is being done, so I would encourage you to digest the whole section, line by line.
I am pretty sure that you cannot do this in TextPad by itself for Searching, but maybe this will provide you another sensible solution.
Hope this was helpful...............good luck,
Bob