Fix user group detection

There was a slight error in #43 with how it searched the groups. This caused the script to not detect groups at the beginning or end of the list due to whitespace matches.

I have a PR inbound that fixes this by using a regex instead.