feat:完善项目信息
This commit is contained in:
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user