[chore]: Bump mvdan.cc/xurls/v2 from 2.5.0 to 2.6.0 (#3643)

Bumps [mvdan.cc/xurls/v2](https://github.com/mvdan/xurls) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/mvdan/xurls/releases)
- [Commits](https://github.com/mvdan/xurls/compare/v2.5.0...v2.6.0)

---
updated-dependencies:
- dependency-name: mvdan.cc/xurls/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2025-01-14 13:11:20 +00:00 committed by GitHub
commit b95498b8c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 5284 additions and 1449 deletions

View file

@ -2,7 +2,7 @@
[![Go Reference](https://pkg.go.dev/badge/mvdan.cc/xurls/v2.svg)](https://pkg.go.dev/mvdan.cc/xurls/v2)
Extract urls from text using regular expressions. Requires Go 1.19 or later.
Extract urls from text using regular expressions. Requires Go 1.22 or later.
```go
import "mvdan.cc/xurls/v2"
@ -18,8 +18,8 @@ func main() {
}
```
Since API is centered around [regexp.Regexp](https://golang.org/pkg/regexp/#Regexp),
many other methods are available, such as finding the [byte indexes](https://golang.org/pkg/regexp/#Regexp.FindAllIndex)
Since API is centered around [regexp.Regexp](https://pkg.go.dev/regexp#Regexp),
many other methods are available, such as finding the [byte indexes](https://pkg.go.dev/regexp#Regexp.FindAllIndex)
for all matches.
The regular expressions are compiled when the API is first called.

View file

@ -24,6 +24,7 @@ var Schemes = []string{
`apt`,
`ar`,
`ark`,
`at`,
`attachment`,
`aw`,
`barion`,
@ -32,7 +33,9 @@ var Schemes = []string{
`bitcoin`,
`bitcoincash`,
`blob`,
`bluetooth`,
`bolo`,
`brid`,
`browserext`,
`cabal`,
`calculator`,
@ -59,6 +62,7 @@ var Schemes = []string{
`dat`,
`data`,
`dav`,
`dhttp`,
`diaspora`,
`dict`,
`did`,
@ -110,6 +114,7 @@ var Schemes = []string{
`ham`,
`hcap`,
`hcp`,
`hs20`,
`http`,
`https`,
`hxxp`,
@ -147,9 +152,11 @@ var Schemes = []string{
`ldap`,
`ldaps`,
`leaptofrogans`,
`lid`,
`lorawan`,
`lpa`,
`lvlt`,
`machineProvisioningProgressReporter`,
`magnet`,
`mailserver`,
`mailto`,
@ -179,6 +186,7 @@ var Schemes = []string{
`ms-help`,
`ms-infopath`,
`ms-inputapp`,
`ms-launchremotedesktop`,
`ms-lockscreencomponent-config`,
`ms-media-stream-id`,
`ms-meetnow`,
@ -187,9 +195,12 @@ var Schemes = []string{
`ms-newsandinterests`,
`ms-officeapp`,
`ms-people`,
`ms-personacard`,
`ms-project`,
`ms-powerpoint`,
`ms-publisher`,
`ms-recall`,
`ms-remotedesktop`,
`ms-remotedesktop-launch`,
`ms-restoretabcompanion`,
`ms-screenclip`,
@ -238,6 +249,8 @@ var Schemes = []string{
`mumble`,
`mupdate`,
`mvn`,
`mvrp`,
`mvrps`,
`news`,
`nfs`,
`ni`,
@ -250,6 +263,7 @@ var Schemes = []string{
`onenote`,
`onenote-cmd`,
`opaquelocktoken`,
`openid`,
`openpgp4fpr`,
`otpauth`,
`p1`,
@ -290,6 +304,7 @@ var Schemes = []string{
`sftp`,
`sgn`,
`shc`,
`shelter`,
`sieve`,
`simpleledger`,
`simplex`,
@ -321,12 +336,15 @@ var Schemes = []string{
`tag`,
`taler`,
`teamspeak`,
`teapot`,
`teapots`,
`tel`,
`teliaeid`,
`telnet`,
`tftp`,
`things`,
`thismessage`,
`thzp`,
`tip`,
`tn3270`,
`tool`,
@ -367,6 +385,8 @@ var Schemes = []string{
`xmlrpc.beep`,
`xmlrpc.beeps`,
`xmpp`,
`xftp`,
`xrcp`,
`xri`,
`ymsgr`,
`z39.50`,

View file

@ -10,7 +10,6 @@ package xurls
var TLDs = []string{
`aaa`,
`aarp`,
`abarth`,
`abb`,
`abbott`,
`abbvie`,
@ -45,7 +44,6 @@ var TLDs = []string{
`airtel`,
`akdn`,
`al`,
`alfaromeo`,
`alibaba`,
`alipay`,
`allfinanz`,
@ -96,7 +94,6 @@ var TLDs = []string{
`author`,
`auto`,
`autos`,
`avianca`,
`aw`,
`aws`,
`ax`,
@ -107,7 +104,6 @@ var TLDs = []string{
`baby`,
`baidu`,
`banamex`,
`bananarepublic`,
`band`,
`bank`,
`bar`,
@ -224,7 +220,6 @@ var TLDs = []string{
`cba`,
`cbn`,
`cbre`,
`cbs`,
`cc`,
`cd`,
`center`,
@ -253,7 +248,6 @@ var TLDs = []string{
`citi`,
`citic`,
`city`,
`cityeats`,
`ck`,
`cl`,
`claims`,
@ -274,7 +268,6 @@ var TLDs = []string{
`college`,
`cologne`,
`com`,
`comcast`,
`commbank`,
`community`,
`company`,
@ -287,7 +280,6 @@ var TLDs = []string{
`contact`,
`contractors`,
`cooking`,
`cookingchannel`,
`cool`,
`coop`,
`corsica`,
@ -314,7 +306,6 @@ var TLDs = []string{
`cymru`,
`cyou`,
`cz`,
`dabur`,
`dad`,
`dance`,
`data`,
@ -393,7 +384,6 @@ var TLDs = []string{
`esq`,
`estate`,
`et`,
`etisalat`,
`eu`,
`eurovision`,
`eus`,
@ -419,7 +409,6 @@ var TLDs = []string{
`ferrari`,
`ferrero`,
`fi`,
`fiat`,
`fidelity`,
`fido`,
`film`,
@ -445,7 +434,6 @@ var TLDs = []string{
`fo`,
`foo`,
`food`,
`foodnetwork`,
`football`,
`ford`,
`forex`,
@ -458,7 +446,6 @@ var TLDs = []string{
`fresenius`,
`frl`,
`frogans`,
`frontdoor`,
`frontier`,
`ftr`,
`fujitsu`,
@ -530,7 +517,6 @@ var TLDs = []string{
`gs`,
`gt`,
`gu`,
`guardian`,
`gucci`,
`guge`,
`guide`,
@ -551,7 +537,6 @@ var TLDs = []string{
`helsinki`,
`here`,
`hermes`,
`hgtv`,
`hiphop`,
`hisamitsu`,
`hitachi`,
@ -573,7 +558,6 @@ var TLDs = []string{
`host`,
`hosting`,
`hot`,
`hoteles`,
`hotels`,
`hotmail`,
`house`,
@ -661,7 +645,6 @@ var TLDs = []string{
`kia`,
`kids`,
`kim`,
`kinder`,
`kindle`,
`kitchen`,
`kiwi`,
@ -686,7 +669,6 @@ var TLDs = []string{
`lamborghini`,
`lamer`,
`lancaster`,
`lancia`,
`land`,
`landrover`,
`lanxess`,
@ -760,7 +742,6 @@ var TLDs = []string{
`markets`,
`marriott`,
`marshalls`,
`maserati`,
`mattel`,
`mba`,
`mc`,
@ -775,6 +756,7 @@ var TLDs = []string{
`memorial`,
`men`,
`menu`,
`merck`,
`merckmsd`,
`mg`,
`mh`,
@ -820,7 +802,6 @@ var TLDs = []string{
`mu`,
`museum`,
`music`,
`mutual`,
`mv`,
`mw`,
`mx`,
@ -830,7 +811,6 @@ var TLDs = []string{
`nab`,
`nagoya`,
`name`,
`natura`,
`navy`,
`nba`,
`nc`,
@ -861,7 +841,6 @@ var TLDs = []string{
`nl`,
`no`,
`nokia`,
`northwesternmutual`,
`norton`,
`now`,
`nowruz`,
@ -880,7 +859,6 @@ var TLDs = []string{
`okinawa`,
`olayan`,
`olayangroup`,
`oldnavy`,
`ollo`,
`om`,
`omega`,
@ -908,7 +886,6 @@ var TLDs = []string{
`partners`,
`parts`,
`party`,
`passagens`,
`pay`,
`pccw`,
`pe`,
@ -1009,7 +986,6 @@ var TLDs = []string{
`rio`,
`rip`,
`ro`,
`rocher`,
`rocks`,
`rodeo`,
`rogers`,
@ -1044,7 +1020,6 @@ var TLDs = []string{
`sbi`,
`sbs`,
`sc`,
`sca`,
`scb`,
`schaeffler`,
`schmidt`,
@ -1073,7 +1048,6 @@ var TLDs = []string{
`sh`,
`shangrila`,
`sharp`,
`shaw`,
`shell`,
`shia`,
`shiksha`,
@ -1082,7 +1056,6 @@ var TLDs = []string{
`shopping`,
`shouji`,
`show`,
`showtime`,
`si`,
`silk`,
`sina`,
@ -1180,7 +1153,6 @@ var TLDs = []string{
`tiaa`,
`tickets`,
`tienda`,
`tiffany`,
`tips`,
`tires`,
`tirol`,
@ -1210,7 +1182,6 @@ var TLDs = []string{
`trading`,
`training`,
`travel`,
`travelchannel`,
`travelers`,
`travelersinsurance`,
`trust`,
@ -1267,14 +1238,12 @@ var TLDs = []string{
`vlaanderen`,
`vn`,
`vodka`,
`volkswagen`,
`volvo`,
`vote`,
`voting`,
`voto`,
`voyage`,
`vu`,
`vuelos`,
`wales`,
`walmart`,
`walter`,
@ -1312,7 +1281,6 @@ var TLDs = []string{
`wtf`,
`xbox`,
`xerox`,
`xfinity`,
`xihuan`,
`xin`,
`xxx`,
@ -1361,7 +1329,6 @@ var TLDs = []string{
`ישראל`,
`קום`,
`ابوظبي`,
`اتصالات`,
`ارامكو`,
`الاردن`,
`البحرين`,

View file

@ -2,6 +2,6 @@
package xurls
const allowedUcsChar = "¡-ᙿᚁ-\u1fff\u200b-‧\u202a-\u202e‰-⁞\u2060-\u2fff、-\ud7ff豈-\ufdcfﷰ-\uffef𐀀-\U0001fffd𠀀-\U0002fffd𰀀-\U0003fffd\U00040000-\U0004fffd\U00050000-\U0005fffd\U00060000-\U0006fffd\U00070000-\U0007fffd\U00080000-\U0008fffd\U00090000-\U0009fffd\U000a0000-\U000afffd\U000b0000-\U000bfffd\U000c0000-\U000cfffd\U000d0000-\U000dfffd\U000e1000-\U000efffd"
const allowedUcsChar = "¡-ᙿᚁ-\u1fff\u200b-‧\u202a-\u202e‰-⁞\u2060-\u2fff、-\ud7ff豈-ﷰ-\uffef𐀀-\U0001fffd𠀀-\U0002fffd𰀀-\U0003fffd\U00040000-\U0004fffd\U00050000-\U0005fffd\U00060000-\U0006fffd\U00070000-\U0007fffd\U00080000-\U0008fffd\U00090000-\U0009fffd\U000a0000-\U000afffd\U000b0000-\U000bfffd\U000c0000-\U000cfffd\U000d0000-\U000dfffd\U000e1000-\U000efffd"
const allowedUcsCharMinusPunc = "¢-¦¨-µ¸-¾À-ͽͿ-ΆΈ-ՙՠ-ֈ֊-ֿׁ-ׂׄ-ׇׅ-ײ\u05f5-؈؋؎-ؚ\u061c-\u061dؠ-٩ٮ-ۓە-ۿ\u070e-߶ߺ-\u082f\u083f-\u085d\u085f-ॣ०-९ॱ-ৼ৾-ੵ\u0a77-૯૱-\u0c76౸-ಃಅ-ෳ\u0df5-๎๐-๙\u0e5c-༃༓༕-྄྆-࿏࿕-࿘\u0fdb-၉ၐ-ჺჼ-፟፩-᙭ᙯ-ᙿᚁ-ᛪᛮ-᜴\u1737-៓ៗ៛-\u17ff᠆-\u1943᥆-\u1a1dᨠ-\u1a9fᪧ\u1aae-᭙᭡-\u1bfbᰀ-\u1c3a᱀-ᱽᲀ-Ჿ\u1cc8-᳔᳒-\u1fff\u200b-―‘-‟\u202a-\u202e-›‿-⁀⁄-⁆⁒⁔\u2060-\u2cf8⳽ⴀ-ⵯ\u2d71-ⷿ⸂-⸅⸉-⸊⸌-⸍⸗⸚⸜-⸝⸠-⸩ⸯ⸺-⸻⹀⹂⹐-⹑\u2e53-\u2fff〄-〼〾-ヺー-ꓽꔀ-ꘌꘐ-꙲ꙴ-꙽ꙿ-꛱\ua6f8-ꡳ\ua878-\ua8cd꣐-ꣷꣻꣽ-꤭ꤰ-\ua95eꥠ-꧀\ua9ce-\ua9ddꧠ-\uaa5bꩠ-ꫝꫠ-ꫯꫲ-ꯪ꯬-\ud7ff豈-\ufdcfﷰ-️︗-︘\ufe1a-︯︱-﹄﹇-﹈﹍-\ufe53-﹞﹢-\ufe67﹩\ufe6c-\uff00-----⦆「-」ヲ-\uffef𐀀-\U000100ff\U00010103-\U0001039e𐎠-𐏏𐏑-\U0001056e\U00010570-\U00010856𐡘-\U0001091e𐤠-\U0001093e\U00010940-\U00010a4f\U00010a59-𐩾𐪀-𐫯\U00010af7-\U00010b38𐭀-\U00010b98\U00010b9d-𐽔\U00010f5a-𑁆\U0001104e-𑂺\U000110bd\U000110c2-𑄿𑅄-𑅳𑅶-𑇄𑇉-𑇌𑇎-𑇚𑇜\U000111e0-𑈷𑈾-𑊨\U000112aa-𑑊𑑐-𑑙\U0001145c𑑞-𑓅𑓇-𑗀𑗘-𑙀𑙄-\U0001165f\U0001166d-𑜻𑜿-𑠺\U0001183c-𑥃\U00011947-𑧡𑧣-𑨾𑩇-𑪙𑪝\U00011aa3-𑱀\U00011c46-\U00011c6f𑱲-𑻶\U00011ef9-\U00011ffe𒀀-\U0001246f\U00012475-\U00016a6d\U00016a70-𖫴\U00016af6-𖬶𖬼-𖭃𖭅-𖺖\U00016e9b-𖿡𖿣-𛲞\U0001bca0-𝪆\U0001da8c-\U0001e95d\U0001e960-\U0001fffd𠀀-\U0002fffd𰀀-\U0003fffd\U00040000-\U0004fffd\U00050000-\U0005fffd\U00060000-\U0006fffd\U00070000-\U0007fffd\U00080000-\U0008fffd\U00090000-\U0009fffd\U000a0000-\U000afffd\U000b0000-\U000bfffd\U000c0000-\U000cfffd\U000d0000-\U000dfffd\U000e1000-\U000efffd"
const allowedUcsCharMinusPunc = "¢-¦¨-µ¸-¾À-ͽͿ-ΆΈ-ՙՠ-ֈ֊-ֿׁ-ׂׄ-ׇׅ-ײ\u05f5-؈؋؎-ؚ\u061cؠ-٩ٮ-ۓە-ۿ\u070e-߶ߺ-\u082f\u083f-\u085d\u085f-ॣ०-९ॱ-ৼ৾-ੵ\u0a77-૯૱-\u0c76౸-ಃಅ-ෳ\u0df5-๎๐-๙\u0e5c-༃༓༕-྄྆-࿏࿕-࿘\u0fdb-၉ၐ-ჺჼ-፟፩-᙭ᙯ-ᙿᚁ-ᛪᛮ-᜴\u1737-៓ៗ៛-\u17ff᠆-\u1943᥆-\u1a1dᨠ-\u1a9fᪧ\u1aae-᭙᭡-᭼\u1b7f-\u1bfbᰀ-\u1c3a᱀-ᱽᲀ-Ჿ\u1cc8-᳔᳒-\u1fff\u200b-―‘-‟\u202a-\u202e-›‿-⁀⁄-⁆⁒⁔\u2060-\u2cf8⳽ⴀ-ⵯ\u2d71-ⷿ⸂-⸅⸉-⸊⸌-⸍⸗⸚⸜-⸝⸠-⸩ⸯ⸺-⸻⹀⹂⹐-⹑-\u2fff〄-〼〾-ヺー-ꓽꔀ-ꘌꘐ-꙲ꙴ-꙽ꙿ-꛱\ua6f8-ꡳ\ua878-\ua8cd꣐-ꣷꣻꣽ-꤭ꤰ-\ua95eꥠ-꧀\ua9ce-\ua9ddꧠ-\uaa5bꩠ-ꫝꫠ-ꫯꫲ-ꯪ꯬-\ud7ff豈-ﷰ-️︗-︘\ufe1a-︯︱-﹄﹇-﹈﹍-\ufe53-﹞﹢-\ufe67﹩\ufe6c-\uff00-----⦆「-」ヲ-\uffef𐀀-\U000100ff\U00010103-\U0001039e𐎠-𐏏𐏑-\U0001056e𐕰-\U00010856𐡘-\U0001091e𐤠-\U0001093e\U00010940-\U00010a4f\U00010a59-𐩾𐪀-𐫯\U00010af7-\U00010b38𐭀-\U00010b98\U00010b9d-𐽔\U00010f5a-𐾅\U00010f8a-𑁆\U0001104e-𑂺\U000110bd𑃂-𑄿𑅄-𑅳𑅶-𑇄𑇉-𑇌𑇎-𑇚𑇜\U000111e0-𑈷𑈾-𑊨\U000112aa-𑑊𑑐-𑑙\U0001145c𑑞-𑓅𑓇-𑗀𑗘-𑙀𑙄-\U0001165f\U0001166d-𑚸\U000116ba-𑜻𑜿-𑠺\U0001183c-𑥃\U00011947-𑧡𑧣-𑨾𑩇-𑪙𑪝\U00011aa3-\U00011aff\U00011b0a-𑱀\U00011c46-\U00011c6f𑱲-𑻶\U00011ef9-𑽂𑽐-\U00011ffe𒀀-\U0001246f\U00012475-𒿰\U00012ff3-\U00016a6d𖩰-𖫴\U00016af6-𖬶𖬼-𖭃𖭅-𖺖\U00016e9b-𖿡𖿣-𛲞\U0001bca0-𝪆\U0001da8c-\U0001e95d\U0001e960-\U0001fffd𠀀-\U0002fffd𰀀-\U0003fffd\U00040000-\U0004fffd\U00050000-\U0005fffd\U00060000-\U0006fffd\U00070000-\U0007fffd\U00080000-\U0008fffd\U00090000-\U0009fffd\U000a0000-\U000afffd\U000b0000-\U000bfffd\U000c0000-\U000cfffd\U000d0000-\U000dfffd\U000e1000-\U000efffd"

View file

@ -75,7 +75,7 @@ const (
`)`
ipv6Addr = `(?:` + ipv6AddrMinusEmpty + `|::)`
ipAddrMinusEmpty = `(?:` + ipv6AddrMinusEmpty + `|\b` + ipv4Addr + `\b)`
port = `(?::[0-9]*)?`
port = `(?::[0-9]+)?`
)
// AnyScheme can be passed to StrictMatchingScheme to match any possibly valid
@ -89,8 +89,10 @@ var SchemesNoAuthority = []string{
`bitcoin`, // Bitcoin
`cid`, // Content-ID
`file`, // Files
`geo`, // Geographic location
`magnet`, // Torrent magnets
`mailto`, // Mail
`matrix`, // Matrix
`mid`, // Message-ID
`sms`, // SMS
`tel`, // Telephone
@ -163,7 +165,7 @@ func relaxedExp() string {
hostName := `(?:` + domain + `|\[` + ipv6Addr + `\]|\b` + ipv4Addr + `\b)`
webURL := hostName + port + `(?:/` + pathCont + `|/)?`
email := `[a-zA-Z0-9._%\-+]+@` + domain
email := `(?P<relaxedEmail>[a-zA-Z0-9._%\-+]+@` + domain + `)`
return strictExp() + `|` + webURL + `|` + email + `|` + ipv6AddrMinusEmpty
}
@ -178,7 +180,10 @@ func Strict() *regexp.Regexp {
}
// Relaxed produces a regexp that matches any URL matched by Strict, plus any
// URL with no scheme or email address.
// URL or email address with no scheme.
//
// Email addresses without a scheme match the `relaxedEmail` subexpression,
// which can be used to filter them as needed.
func Relaxed() *regexp.Regexp {
relaxedInit.Do(func() {
relaxedRe = regexp.MustCompile(relaxedExp())