mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 12:24:55 +00:00
These have been broken since fd07c943adc92ade47ccc8f79894bc23bb5f5b8e 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 };
|
|
}
|