Fix secg regex

There was a bug that occurred when referenced security groups had a zero in their uuid. It turns out the validation method used its own regular expression to check uuids. Fixed it by making it use the same regular expression that's used in the web api.

Also did some small scale refactoring of the methods involved in this bug.