2g

func VerifyUrl(url string) bool {
    reg_url := regexp.MustCompile(`(https|http|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]`)
    //re := regexp.MustCompile(`(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?`)
    result_url := reg_url.FindAllStringSubmatch(url, -1)
    if len(result_url) == 0 {
        return false
    }
    return true
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code