gopkg.in/alecthomas/gometalinter.v3@v3.0.0/_linters/src/github.com/client9/misspell/url.go (about) 1 package misspell 2 3 import ( 4 "regexp" 5 ) 6 7 // Regexp for URL https://mathiasbynens.be/demo/url-regex 8 // 9 // original @imme_emosol (54 chars) has trouble with dashes in hostname 10 // @(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS 11 var reURL = regexp.MustCompile(`(?i)(https?|ftp)://(-\.)?([^\s/?\.#]+\.?)+(/[^\s]*)?`) 12 13 // StripURL attemps to replace URLs with blank spaces, e.g. 14 // "xxx http://foo.com/ yyy -> "xxx yyyy" 15 func StripURL(s string) string { 16 return reURL.ReplaceAllStringFunc(s, replaceWithBlanks) 17 }