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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?