allow some regex chars
This commit is contained in:
parent
31c3dee3d1
commit
98692a8d62
@ -128,7 +128,7 @@ class Util {
|
||||
* @return {string} The sanitised expression
|
||||
* @memberof Util
|
||||
*/
|
||||
static sanitiseRegex(input, allowed = ['?', '\\', '(', ')', '|']) {
|
||||
static sanitiseRegex(input, allowed = ['?', '\\', '(', ')', '|', '\\[', '\\]', '.']) {
|
||||
if (!input) throw new Error('Missing input');
|
||||
const reg = new RegExp(`[${this.regChars.filter((char) => !allowed.includes(char)).join('')}]`, 'gu');
|
||||
return input.replace(reg, '\\$&');
|
||||
|
Loading…
Reference in New Issue
Block a user