From 31740f4ec613e81005f6a95e800145d827d56353 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 11 May 2021 22:18:52 +0530 Subject: [PATCH] Put regex into separate file Signed-off-by: RMidhunSuresh --- src/domain/session/room/timeline/linkify/linkify.js | 2 +- src/domain/session/room/timeline/linkify/regex.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/domain/session/room/timeline/linkify/regex.js diff --git a/src/domain/session/room/timeline/linkify/linkify.js b/src/domain/session/room/timeline/linkify/linkify.js index bcc722a4..6ebf4e9f 100644 --- a/src/domain/session/room/timeline/linkify/linkify.js +++ b/src/domain/session/room/timeline/linkify/linkify.js @@ -1,4 +1,4 @@ -const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:[\/#][^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui +import { regex } from "./regex.js"; export function linkify(text, callback) { const matches = text.matchAll(regex); diff --git a/src/domain/session/room/timeline/linkify/regex.js b/src/domain/session/room/timeline/linkify/regex.js new file mode 100644 index 00000000..fe8c94eb --- /dev/null +++ b/src/domain/session/room/timeline/linkify/regex.js @@ -0,0 +1 @@ +export const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:[\/#][^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui