From ab9a2247e000c0894f2a1d74527f4126b07310ca Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Wed, 26 Jun 2019 20:44:36 +0200 Subject: Fix URL/mail regex for newer TLDs (.space etc) --- js/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/main.ts b/js/main.ts index 765aa25..12f92ab 100644 --- a/js/main.ts +++ b/js/main.ts @@ -254,8 +254,8 @@ function generateMarkupForPlainLinks() { } const contentEl = document.getElementsByClassName('content')[0]; - const urlRegex = /\b([a-z]*:\/\/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b[-a-zA-Z0-9@:%_\+.~#?&//=]*)\b/g; - const mailRegex = /\bmailto:[-a-zA-Z0-9@:%._\+~#=]+@(?:[-a-zA-Z0-9@:%._\+~#=]+\.)+[a-z]{2,4}\b/g; + const urlRegex = /\b([a-z]*:\/\/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,}\b[-a-zA-Z0-9@:%_\+.~#?&//=]*)\b/g; + const mailRegex = /\bmailto:[-a-zA-Z0-9@:%._\+~#=]+@(?:[-a-zA-Z0-9@:%._\+~#=]+\.)+[a-z]{2,}\b/g; contentEl.innerHTML = contentEl.innerHTML.replace(urlRegex, match => { let href: string = match; -- cgit v1.2.3-70-g09d2