mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 18:35:11 +08:00
277496b6e0
These have been broken since fd07c943ad
because watched words were not correctly transformed to regexps.
This partially reverts the changes.
10 lines
302 B
JavaScript
10 lines
302 B
JavaScript
export function createWatchedWordRegExp(word) {
|
|
const caseFlag = word.case_sensitive ? "" : "i";
|
|
return new RegExp(word.regexp, `${caseFlag}gu`);
|
|
}
|
|
|
|
export function toWatchedWord(regexp) {
|
|
const [[regexpString, options]] = Object.entries(regexp);
|
|
return { ...options, regexp: regexpString };
|
|
}
|