'u' flag makes RegExp stricter about which characters can be escaped

Fix #80455
This commit is contained in:
Rob Lourens 2019-09-06 15:17:36 -07:00
parent bc9a46a307
commit 4f87889a7f
2 changed files with 2 additions and 2 deletions

View file

@ -70,7 +70,7 @@ export function escape(html: string): string {
* Escapes regular expression characters in a given string
*/
export function escapeRegExpCharacters(value: string): string {
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)\#]/g, '\\$&');
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&');
}
/**

View file

@ -426,7 +426,7 @@ export class SearchWidget extends Widget {
}
try {
// tslint:disable-next-line: no-unused-expression
new RegExp(value);
new RegExp(value, 'u');
} catch (e) {
return { content: e.message };
}