You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 725B

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