feat:完善信息

This commit is contained in:
henry
2021-10-13 17:17:28 +08:00
parent 52dc8cb57d
commit 8f7aeba547
14 changed files with 272 additions and 113 deletions

View File

@ -18,6 +18,17 @@ func ValidateUrl(url string) {
//reg := regexp.MustCompile("^([hH][tT]{2}[pP]:|||[hH][tT]{2}[pP][sS]:|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$")
}
func ValidateIDCard(obj string) bool {
reg := regexp.MustCompile("^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$")
return reg.MatchString(obj)
}
func ValidateIP(ip string) bool {
reg := regexp.MustCompile("^((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}$")
return reg.MatchString(ip)
}
func ValidateCompile(obj, compile string) bool {
reg := regexp.MustCompile(compile)
return reg.MatchString(obj)