bvbej 2 yıl önce
ebeveyn
işleme
82ff57e0f3
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      pkg/validator/rule.go

+ 2 - 2
pkg/validator/rule.go

@@ -11,12 +11,12 @@ func isoPhone(fl validator.FieldLevel) bool {
 }
 
 func chinesePhone(fl validator.FieldLevel) bool {
-	ok, _ := regexp.MatchString(`^1[3-9][0-9]{9}$`, fl.Field().String())
+	ok, _ := regexp.MatchString(`^1[3-9]\d{9}$`, fl.Field().String())
 	return ok
 }
 
 func idCard(fl validator.FieldLevel) bool {
-	isIdCard, _ := regexp.MatchString(`^[1-9]\d{7}((0\d)|(1[0-2]))(([0-2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0-2]\d)|3[0-1])\d{3}([0-9]|X)$`, fl.Field().String())
+	isIdCard, _ := regexp.MatchString(`^[1-9]\d{7}((0\d)|(1[0-2]))(([0-2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0-2]\d)|3[0-1])\d{3}(\d|X)$`, fl.Field().String())
 	return isIdCard
 }