You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varschemeRegex=/(?:[A-Za-z][-.+A-Za-z0-9]*:(?![A-Za-z][-.+A-Za-z0-9]*:\/\/)(?!\d+\/?)(?:\/\/)?)/,// match protocol, allow in format "http://" or "mailto:". However, do not match the first part of something like 'link:http://www.google.com' (i.e. don't match "link:"). Also, make sure we don't interpret 'google.com:8000' as if 'google.com' was a protocol here (i.e. ignore a trailing port number in this regex)
3609
+
varschemeRegex=/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/,// match protocol, allow in format "http://" or "mailto:". However, do not match the first part of something like 'link:http://www.google.com' (i.e. don't match "link:"). Also, make sure we don't interpret 'google.com:8000' as if 'google.com' was a protocol here (i.e. ignore a trailing port number in this regex)
'(?:',// parens to cover match for scheme (optional), and domain
3615
3621
'(',// *** Capturing group $1, for a scheme-prefixed url (ex: http://google.com)
3616
3622
schemeRegex.source,
3617
-
domainNameRegex.source,
3623
+
getDomainNameStr(2),
3618
3624
')',
3619
3625
3620
3626
'|',
3621
3627
3622
-
'(',// *** Capturing group $2, for a 'www.' prefixed url (ex: www.google.com)
3623
-
'(//)?',// *** Capturing group $3 for an optional protocol-relative URL. Must be at the beginning of the string or start with a non-word character (handled later)
3628
+
'(',// *** Capturing group $4 for a 'www.' prefixed url (ex: www.google.com)
3629
+
'(//)?',// *** Capturing group $5 for an optional protocol-relative URL. Must be at the beginning of the string or start with a non-word character (handled later)
3624
3630
wwwRegex.source,
3625
-
domainNameRegex.source,
3631
+
getDomainNameStr(6),
3626
3632
')',
3627
3633
3628
3634
'|',
3629
3635
3630
-
'(',// *** Capturing group $4, for known a TLD url (ex: google.com)
3631
-
'(//)?',// *** Capturing group $5 for an optional protocol-relative URL. Must be at the beginning of the string or start with a non-word character (handled later)
3632
-
domainNameRegex.source+'\\.',
3636
+
'(',// *** Capturing group $8, for known a TLD url (ex: google.com)
3637
+
'(//)?',// *** Capturing group $9 for an optional protocol-relative URL. Must be at the beginning of the string or start with a non-word character (handled later)
3638
+
getDomainNameStr(10)+'\\.',
3633
3639
tldRegex.source,
3634
3640
'(?![-'+alphaNumericCharsStr+'])',// TLD not followed by a letter, behaves like unicode-aware \b
// B. "value" alone (To cover example doctype tag: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">)
// to fix a regex time complexity issue seen with the
1883
1888
// example in https://github.com/gregjacobs/Autolinker.js/issues/172
1884
1889
'(?:',
1885
-
// *** Capturing Group 5 - The tag name for a tag with attributes
1890
+
// *** Capturing Group 6 - The tag name for a tag with attributes
1886
1891
'('+tagNameRegex.source+')',
1887
1892
1888
1893
'\\s+',// must have at least one space after the tag name to prevent ReDoS issue (issue #172)
1889
1894
1890
1895
// Zero or more attributes following the tag name
1891
1896
'(?:',
1892
1897
'(?:\\s+|\\b)',// any number of whitespace chars before an attribute. NOTE: Using \s* here throws Chrome into an infinite loop for some reason, so using \s+|\b instead
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "autolinker",
3
-
"version": "1.6.1",
3
+
"version": "1.6.2",
4
4
"description": "Utility to automatically link the URLs, email addresses, phone numbers, hashtags, and mentions (Twitter, Instagram) in a given block of text/HTML",
0 commit comments