Make regex module-level constant

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-05-11 20:32:36 +05:30
parent 03208b88d5
commit 7be9f93909

View file

@ -1,5 +1,6 @@
export function linkify(text, callback) {
const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:\/[^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui const regex = /(?:https|http|ftp):\/\/[a-zA-Z0-9:.\[\]#-]+(?:\/[^\s]*[^\s.,?!]|[^\s\u{80}-\u{10ffff}.,?!])/gui
export function linkify(text, callback) {
const matches = text.matchAll(regex); const matches = text.matchAll(regex);
let curr = 0; let curr = 0;
for (let match of matches) { for (let match of matches) {