Remove all invalid characters upon filtering

Fixes #4.
This commit is contained in:
Florine W. Dekker 2019-11-25 00:04:41 +01:00
parent e44bfa1c36
commit 2cb3f67b74
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@
filterBaseString(baseString) {
// Regex from https://stackoverflow.com/a/3561711/
const regexSafeAlphabet = this.alphabet.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
return baseString.replace(new RegExp(`[^${regexSafeAlphabet}]`), "");
return baseString.replace(new RegExp(`[^${regexSafeAlphabet}]`, "g"), "");
}
}