xurls

Extract urls from text

  • 所有者: mvdan/xurls
  • 平台:
  • 许可证: BSD 3-Clause "New" or "Revised" License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

xurls

GoDoc

Extract urls from text using regular expressions. Requires Go 1.12 or later.

import "mvdan.cc/xurls/v2"

func main() {
	rxRelaxed := xurls.Relaxed()
	rxRelaxed.FindString("Do gophers live in golang.org?")  // "golang.org"
	rxRelaxed.FindString("This string does not have a URL") // ""

	rxStrict := xurls.Strict()
	rxStrict.FindAllString("must have scheme: http://foo.com/.", -1) // []string{"http://foo.com/"}
	rxStrict.FindAllString("no scheme, no match: foo.com", -1)       // []string{}
}

Note that the funcs compile regexes, so avoid calling them repeatedly.

cmd/xurls

To install the tool globally:

cd $(mktemp -d); go mod init tmp; GO111MODULE=on go get mvdan.cc/xurls/v2/cmd/xurls
$ echo "Do gophers live in http://golang.org?", xurls
http://golang.org

主要指标

概览
名称与所有者mvdan/xurls
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证BSD 3-Clause "New" or "Revised" License
所有者活动
创建于2015-01-12 01:28:46
推送于2025-02-22 14:31:19
最后一次提交2025-02-22 14:31:16
发布数21
最新版本名称v2.6.0 (发布于 2025-01-02 16:56:14)
第一版名称v0.1 (发布于 2015-01-31 18:17:14)
用户参与
星数1.2k
关注者数23
派生数117
提交数452
已启用问题?
问题数55
打开的问题数1
拉请求数19
打开的拉请求数1
关闭的拉请求数7
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?