if ($sock(pre.ums.*,%open) != $null) { ?
or maybe if ($sock($+(pre.,%group,.*),%open) != $null) { ?