mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-17 17:58:13 -05:00
| .. | ||
| .gitignore | ||
| .travis.yml | ||
| BUILD | ||
| LICENSE | ||
| README.md | ||
| regex.go | ||
| schemes.go | ||
| tlds.go | ||
| tlds_pseudo.go | ||
| xurls.go | ||
xurls
Extract urls from text using regular expressions.
go get github.com/mvdan/xurls
import "github.com/mvdan/xurls"
func main() {
xurls.Relaxed.FindString("Do gophers live in golang.org?")
// "golang.org"
xurls.Relaxed.FindAllString("foo.com is http://foo.com/.", -1)
// []string{"foo.com", "http://foo.com/"}
xurls.Strict.FindAllString("foo.com is http://foo.com/.", -1)
// []string{"http://foo.com/"}
}
cmd/xurls
Reads text and prints one url per line.
go get github.com/mvdan/xurls/cmd/xurls
$ echo "Do gophers live in http://golang.org?" | xurls
http://golang.org