Skip to content

Commit

Permalink
ensure port has at least one number
Browse files Browse the repository at this point in the history
Fixes #74.
  • Loading branch information
cspeidel committed Nov 17, 2023
1 parent ebdb1cf commit e179eda
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xurls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions xurls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func TestRegexes(t *testing.T) {
{`"foo.com/bar"`, `foo.com/bar`},
{`what is foo.com?`, `foo.com`},
{`the foo.com!`, `foo.com`},
{`check of foo.com: ok`, `foo.com`},

{`foo@bar`, nil},
{`foo@bar.a`, nil},
Expand Down

0 comments on commit e179eda

Please sign in to comment.