For that I'd use a line like this:
In the condition line of a trigger:
"alive _x" count (units grp1 + units grp2 + units grp3 + units grp4 + units grp5) == 0
In a script:
? "alive _x" count (units grp1 + units grp2 + units grp3 + units grp4 + units grp5) == 0
However... I often prefer to use a 'morale broken' sort of condition.
What I mean is that rather forcing the player to hunt down and kill
all enemy units, you can detect when the last few are running away.
Often they'll run far away and the player will have a hard time finding all the cowardly sods ;D
I lean towards using something like this:
("((east countside units _x) <= (""fleeing _x"" count units _x))" count [ grp1, grp2, grp3, grp4, grp5 ]) == 5)
Looks nasty, but what that does is compare the number of living units1 to the number of units running away2. If the number of units fleeing is equal (or greater... just incase) than the units alive, the condition trips.
Here I've got it working on 5 groups, but you can use it on as many as you need by adding them into the array at the end and changing the last number.
1 (east countside units _x) --> same as "alive _x" count... etc.
2 (""fleeing _x"" count units _x)