I have the following piece of code:
func GetUUIDValidator(text string) bool { r, _ := regexp.Compile("/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/") return r.Match([]byte(text)) } But when I pass fbd3036f-0f1c-4e98-b71c-d4cd61213f90 as a value, I got false, while indeed it is an UUID v4.
What am I doing wrong?
regex.MustCompilefor usage like the one in your code. Also, Go style regexes don't use // delimiters. Read the documentation to understand how Go regex work.