mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Explain the reason for double escapes
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
ef15968a3d
commit
b521797f4d
@ -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 scheme = "(?:https|http|ftp):\\/\\/";
|
||||||
const host = "[a-zA-Z0-9:.\\[\\]-]";
|
const host = "[a-zA-Z0-9:.\\[\\]-]";
|
||||||
|
|
||||||
@ -24,7 +29,6 @@ Things to keep in mind:
|
|||||||
them in path or fragment components.
|
them in path or fragment components.
|
||||||
https://matrix.org/<smiley> - valid
|
https://matrix.org/<smiley> - valid
|
||||||
https://matrix.org<smiley> - invalid
|
https://matrix.org<smiley> - invalid
|
||||||
|
|
||||||
2. Do not treat punctuation at the end as a part of the URL (.,?!)
|
2. Do not treat punctuation at the end as a part of the URL (.,?!)
|
||||||
*/
|
*/
|
||||||
const urlRegex = `${scheme}${host}+(?:${additional}|${endASCII})`;
|
const urlRegex = `${scheme}${host}+(?:${additional}|${endASCII})`;
|
||||||
|
Loading…
Reference in New Issue
Block a user