allow some regex chars

This commit is contained in:
Erik 2021-06-09 14:17:43 +03:00
parent 31c3dee3d1
commit 98692a8d62
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -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, '\\$&');