package xurls
import "github.com/mvdan/xurls"
Package xurls extracts urls from plain text using regular expressions.
Index ¶
Examples ¶
Variables ¶
var ( // Relaxed matches all the urls it can find. Relaxed = regexp.MustCompile(relaxed) // Strict only matches urls with a scheme to avoid false positives. Strict = regexp.MustCompile(strict) )
var PseudoTLDs = []string{ `bit`, `example`, `exit`, `gnu`, `i2p`, `invalid`, `local`, `localhost`, `test`, `zkey`, }
PseudoTLDs is a sorted list of some widely used unofficial TLDs.
Sources:
- https://en.wikipedia.org/wiki/Pseudo-top-level_domain
- https://en.wikipedia.org/wiki/Category:Pseudo-top-level_domains
- https://tools.ietf.org/html/draft-grothoff-iesg-special-use-p2p-names-00
- https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml
var SchemesNoAuthority = []string{ `bitcoin`, `file`, `magnet`, `mailto`, `sms`, `tel`, `xmpp`, }
SchemesNoAuthority is a sorted list of some well-known url schemes that are followed by ":" instead of "://". Since these are more prone to false positives, we limit their matching.
var TLDs = []string{ /* 1554 elements not displayed */ }
TLDs is a sorted list of all public top-level domains.
Sources:
- https://data.iana.org/TLD/tlds-alpha-by-domain.txt
- https://publicsuffix.org/list/effective_tld_names.dat
Functions ¶
func StrictMatchingScheme ¶
StrictMatchingScheme produces a regexp that matches urls like Strict but whose scheme matches the given regular expression.
Source Files ¶
regex.go schemes.go tlds.go tlds_pseudo.go xurls.go
Directories ¶
Path | Synopsis |
---|---|
cmd | |
cmd/xurls | |
generate | |
generate/regexgen | |
generate/tldsgen |
- Version
- v1.1.0 (latest)
- Published
- Jan 25, 2017
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 2 weeks ago –
Tools for package owners.