mirror of https://github.com/zulip/zulip.git
alert_words: Revert back `before_punctuation` regex to stable one.
In this 009b7bca24
commit `before_punctuation`
regex was updated to use lookbehind feature of regex.
This caused a regex error in some browsers (reported in
Safari) because lookbehind feature is not yet supported
on all the browsers (https://caniuse.com/js-regexp-lookbehind).
This commit fixes that error by reverting to stable regex which
works on all the browsers.
This commit is contained in:
parent
405bc8dabf
commit
37b265495b
|
@ -32,7 +32,7 @@ export function process_message(message) {
|
||||||
|
|
||||||
for (const word of my_alert_words) {
|
for (const word of my_alert_words) {
|
||||||
const clean = _.escapeRegExp(word);
|
const clean = _.escapeRegExp(word);
|
||||||
const before_punctuation = "(?<=\\s)|^|>|[\\(\\\".,';\\[]";
|
const before_punctuation = "\\s|^|>|[\\(\\\".,';\\[]";
|
||||||
const after_punctuation = "(?=\\s)|$|<|[\\)\\\"\\?!:.,';\\]!]";
|
const after_punctuation = "(?=\\s)|$|<|[\\)\\\"\\?!:.,';\\]!]";
|
||||||
|
|
||||||
const regex = new RegExp(`(${before_punctuation})(${clean})(${after_punctuation})`, "ig");
|
const regex = new RegExp(`(${before_punctuation})(${clean})(${after_punctuation})`, "ig");
|
||||||
|
|
Loading…
Reference in New Issue