From 28d4ec779daeca1696fb8e512f65f51f5bec76f3 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 23 Feb 2017 09:37:35 -0800 Subject: [PATCH] Fix localhost links --- src/Linkifier.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Linkifier.ts b/src/Linkifier.ts index e0f5eb92..7a813733 100644 --- a/src/Linkifier.ts +++ b/src/Linkifier.ts @@ -12,8 +12,9 @@ const negatedDomainCharacterSet = '[^\\da-z\\.-]+'; const domainBodyClause = '(' + domainCharacterSet + ')'; const tldClause = '([a-z\\.]{2,6})'; const ipClause = '((\\d{1,3}\\.){3}\\d{1,3})'; +const localHostClause = '(localhost)'; const portClause = '(:\\d{1,5})'; -const hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + ')' + portClause + '?'; +const hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?'; const pathClause = '(\\/[\\/\\w\\.-]*)*'; const queryStringClause = '(\\?[\\w\\[\\]\\(\\)\\/\\?\\!#@$&\'*+,:;]*)?'; const negatedPathCharacterSet = '[^\\/\\w\\.-]+';