feat:完善项目信息

This commit is contained in:
henry
2022-01-13 17:48:41 +08:00
parent 4637a5fb4b
commit 27cb063a6c
11 changed files with 85 additions and 79 deletions

View File

@ -14,8 +14,9 @@ func ValidateEmail(email string) bool {
return reg.MatchString(email)
}
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 ValidateUrl(obj string) bool {
reg := regexp.MustCompile("^(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]")
return reg.MatchString(obj)
}
func ValidateIDCard(obj string) bool {

View File

@ -45,9 +45,13 @@ func TestValidateCompile(t *testing.T) {
//status := ValidateCompile(src, compile)
//t.Log(status)
src := "htt2ps:2134"
//src := "htt2ps:2134"
//t.Log(src)
//compile := "^(http|https):"
//status := ValidateCompile(src, compile)
//t.Log(status)
src := "http://213213213213"
t.Log(src)
compile := "^(http|https):"
status := ValidateCompile(src, compile)
status := ValidateUrl(src)
t.Log(status)
}