• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..23-Jun-2021-

LICENSEH A D23-Jun-20211.5 KiB2824

README.mdH A D23-Jun-2021753 3121

go.modH A D23-Jun-202134 42

go.sumH A D23-Jun-20210

schemes.goH A D23-Jun-20214.1 KiB323315

tlds.goH A D23-Jun-202116 KiB1,5531,544

tlds_pseudo.goH A D23-Jun-2021836 2513

xurls.goH A D23-Jun-20213.7 KiB10783

README.md

1# xurls
2
3[![GoDoc](https://godoc.org/mvdan.cc/xurls?status.svg)](https://godoc.org/mvdan.cc/xurls)
4[![Travis](https://travis-ci.org/mvdan/xurls.svg?branch=master)](https://travis-ci.org/mvdan/xurls)
5
6Extract urls from text using regular expressions. Requires Go 1.10.3 or later.
7
8```go
9import "mvdan.cc/xurls/v2"
10
11func main() {
12	xurls.Relaxed().FindString("Do gophers live in golang.org?")
13	// "golang.org"
14	xurls.Strict().FindAllString("foo.com is http://foo.com/.", -1)
15	// []string{"http://foo.com/"}
16}
17```
18
19Note that the funcs compile regexes, so avoid calling them repeatedly.
20
21#### cmd/xurls
22
23To install the tool globally:
24
25	go get -u mvdan.cc/xurls/cmd/xurls
26
27```shell
28$ echo "Do gophers live in http://golang.org?" | xurls
29http://golang.org
30```
31