mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-02 05:24:50 +08:00
commit
6d992befe5
2 changed files with 8 additions and 4 deletions
|
|
@ -649,6 +649,10 @@ export function remove_non_ascii(str) {
|
|||
return str.replace(/[^\x20-\x7E]/g, "");
|
||||
}
|
||||
|
||||
export function escapeRegExp(str) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
export function cleanTypographySymbols(textToClean) {
|
||||
var specials = {
|
||||
"“": '"', // “ “
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ function hide() {
|
|||
|
||||
async function filter(language) {
|
||||
let filterin = $("#wordFilterPopup .wordIncludeInput").val();
|
||||
filterin = filterin.trim();
|
||||
filterin = filterin.replace(/ /gi, "|");
|
||||
filterin = Misc.escapeRegExp(filterin.trim());
|
||||
filterin = filterin.replace(/\s+/gi, "|");
|
||||
let regincl = new RegExp(filterin, "i");
|
||||
let filterout = $("#wordFilterPopup .wordExcludeInput").val();
|
||||
filterout = filterout.trim();
|
||||
filterout = filterout.replace(/ /gi, "|");
|
||||
filterout = Misc.escapeRegExp(filterout.trim());
|
||||
filterout = filterout.replace(/\s+/gi, "|");
|
||||
let regexcl = new RegExp(filterout, "i");
|
||||
let filteredWords = [];
|
||||
let languageWordList = await Misc.getLanguage(language);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue