$GROUPS$ Returns the list of the groups of which the current user is a member.
So qualification should be like in case you cave GroupA and GroupB are your desired groups.
$GROUPS$ Like "%GroupA%"
Thanks and Regards,
God that was so simple, thanks I was making this way harder than it needed to be.