xurls 从纯文本提取 URL xurls

blov2016-09-07 16:07:47 • 1795 次点击    
这是一个分享于 2016-09-07 16:07:47 的项目,其中的信息可能已经有所发展或是发生改变。

xurls 可以从纯文本中使用正则表达式提取 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/"}
}

Extract urls from textRead More

Latest commit to the master branch on 2-22-2025
Download as zip
授权协议:
BSD
开发语言:
Google Go 查看源码»
操作系统:
跨平台
1795 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传