diff --git a/index.js b/index.js index ef14f73..996cc73 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ const createHtmlElement = require('create-html-element'); // Capture the whole URL in group 1 to keep string.split() support -const urlRegex = () => (/((?:https?(?::\/\/))(?:www\.)?[a-zA-Z0-9-_.]+(?:\.[a-zA-Z0-9]{2,})(?:[-a-zA-Z0-9:%_+.~#?&//=@]*))/g); +const urlRegex = () => (/((?:https?(?::\/\/))[^\s/$.?#].[^\s()]*)/ig); // Get element as string const linkify = (href, options) => createHtmlElement({