diff --git a/src/domain/session/room/timeline/linkify/regex.js b/src/domain/session/room/timeline/linkify/regex.js index a67ce415..b6e970cd 100644 --- a/src/domain/session/room/timeline/linkify/regex.js +++ b/src/domain/session/room/timeline/linkify/regex.js @@ -1,3 +1,8 @@ +/* +The regex is split into component strings; +meaning that any escapes (\) must be also +be escaped. +*/ const scheme = "(?:https|http|ftp):\\/\\/"; const host = "[a-zA-Z0-9:.\\[\\]-]"; @@ -24,7 +29,6 @@ Things to keep in mind: 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})`;