Make regex module-level constant
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
03208b88d5
commit
7be9f93909
1 changed files with 2 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue