Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/rebuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,14 @@ export class REBuilder {
}

get_fuzzy_mail_host () {
// Similar to normal mail host, but without local domains.
// Similar to normal mail host, but
// - TLD as anchor
// - No local domains
return this.cache.src_fuzzy_mail_host ??= new RegExp(
'(?:' +
this.get_ipv6_mail_host().source +
'|' +
`(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source})` +
`(?:(?:(?:${this.get_domain().source})[.]){1,4}(?:${this.get_tld().source}))` +
')' +
this.get_host_terminator().source
)
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/not_links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ http://[1:2:3:4:5:6:7:8:9]/
% Not email
%
foo@bar % Should be at second level domain & with correct tld
foo@bar.badtld
mailto:bar
mailto:user@[::1]
mailto:user@[IPv6:202:NaN]