xurls從純文本提取 URL
xurls 可以從純文本中使用正則表達(dá)式提取 URL。
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/"}
}
評(píng)論
圖片
表情
