/src/gitlab.com/mahina/platform/util/validator.go

https://gitlab.com/mahina/platform · Go · 12 lines · 7 code · 4 blank · 1 comment · 0 complexity · 4151f70a239cb64d0c127460afaeb1e2 MD5 · raw file

  1. package util
  2. import "regexp"
  3. const uuidExpr string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  4. var rxUUID = regexp.MustCompile(uuidExpr)
  5. // IsUUID determines the validity of the passed UUID
  6. func IsUUID(value string) bool {
  7. return rxUUID.MatchString(value)
  8. }