From 714b390cb92c000b68d44362a9d23f2e9734741e Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Wed, 22 May 2019 18:01:30 -0700 Subject: [PATCH] Simplifying regex for URLs --- gopher/url.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gopher/url.go b/gopher/url.go index 17b9f6c..df65386 100644 --- a/gopher/url.go +++ b/gopher/url.go @@ -30,7 +30,7 @@ type Url struct { // an error (or nil). func MakeUrl(u string) (Url, error) { var out Url - re := regexp.MustCompile(`^((?Pgopher|http|https|ftp|telnet):\/\/)?(?P[\w\-\.\d]+)(?::(?P\d+)?)?(?:/(?P[01345679gIhisp])?)?(?P(?:[\/|Uu]?.*)?)?$`) + re := regexp.MustCompile(`^((?Pgopher|http|https|ftp|telnet):\/\/)?(?P[\w\-\.\d]+)(?::(?P\d+)?)?(?:/(?P[01345679gIhisp])?)?(?P.*)?$`) match := re.FindStringSubmatch(u) if valid := re.MatchString(u); !valid {