parent
2cb3f67b74
commit
69fef87cd9
|
@ -86,7 +86,11 @@
|
||||||
|
|
||||||
filterBaseString(baseString) {
|
filterBaseString(baseString) {
|
||||||
// Regex from https://stackoverflow.com/a/3561711/
|
// Regex from https://stackoverflow.com/a/3561711/
|
||||||
const regexSafeAlphabet = this.alphabet.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
const alphabet = this.caseSensitive
|
||||||
|
? this.alphabet
|
||||||
|
: this.alphabet.toLowerCase() + this.alphabet.toUpperCase();
|
||||||
|
const regexSafeAlphabet = alphabet.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||||
|
|
||||||
return baseString.replace(new RegExp(`[^${regexSafeAlphabet}]`, "g"), "");
|
return baseString.replace(new RegExp(`[^${regexSafeAlphabet}]`, "g"), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue