From 7be9f939090da7cec5463185da831ba506f8de76 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 11 May 2021 20:32:36 +0530 Subject: [PATCH] Make regex module-level constant Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/linkify.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/linkify.js b/src/domain/session/room/timeline/linkify.js index 620f38c1..6e877954 100644 --- a/src/domain/session/room/timeline/linkify.js +++ b/src/domain/session/room/timeline/linkify.js @@ -1,5 +1,6 @@ +const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:\/[^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui + export function linkify(text, callback) { - const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:\/[^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui const matches = text.matchAll(regex); let curr = 0; for (let match of matches) {