2022-07-27 go-实用方法-判断字符串为uuid类型 go 遇到需要判断字符串是否为uuid 类型,函数如下 1234func IsValidUUID(uuid string) bool { r := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") return r.MatchString(uuid)} 推荐使用 1234import github.com/robin5911/gtools/strisUuid := str.CheckLikeUUID("e451f79c-f4ab-4c3a-b895-288bc60c2c5b")fmt.Println(isUuid) Newer 虚拟化-numa架构讲解(1) Older go-etcd clientv3 包冲突问题