PowerGREP 5 were released a week or so ago. They've added quite a bit of functionality
since PG4, such as regex recursion, subpatterns, replacement string conditionals,
balancing groups and so on.
Note: The trial is free, but the full version isn't.Release Notes
It isn't obvious from the release notes, but the replacement string conditionals
are recursive. In other words, you can wrap conditionals inside other conditionals
to make it satisfy several conditions before said conditional output a text.
I've been a rather satisfied customer of PowerGREP etc for years, as
a search in these forums will tell you.