From ef15968a3d52ec3f508e7302a8b58ed0bf785749 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 11 May 2021 22:26:45 +0530 Subject: [PATCH] Add some helpful pointers Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/linkify/regex.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/domain/session/room/timeline/linkify/regex.js b/src/domain/session/room/timeline/linkify/regex.js index 7530d301..a67ce415 100644 --- a/src/domain/session/room/timeline/linkify/regex.js +++ b/src/domain/session/room/timeline/linkify/regex.js @@ -19,10 +19,13 @@ const nonASCII = "\\u{80}-\\u{10ffff}"; const endASCII = `[^\\s${nonASCII}.,?!]`; /* -URL must not contain non-ascii characters in host but may contain -them in path or fragment components. -https://matrix.org/ - valid -https://matrix.org - invalid +Things to keep in mind: +1. URL must not contain non-ascii characters in host but may contain + them in path or fragment components. + https://matrix.org/ - valid + https://matrix.org - invalid + +2. Do not treat punctuation at the end as a part of the URL (.,?!) */ const urlRegex = `${scheme}${host}+(?:${additional}|${endASCII})`;