in reply to Re: Re: pattern matching nested { }'s
in thread pattern matching nested { }'s

Well, in that case, just say it to your replacement command:

$text =~ s/(onValidate)\s*$re/$1/g; # or even $text =~ s/(?<=onValidate)\s*$re//g; print $text;

It gives:

   onValidate
   keep this
   {
       remove this {and {this}}
   }