Simplify containsOnlyNormalChars() test
This commit is contained in:
parent
786c2e3d86
commit
35b32e00be
1 changed files with 2 additions and 3 deletions
|
@ -150,11 +150,10 @@ const REPLACED_CHARS: Record<string, RegExp> = Array.from(Object.entries(REPLACE
|
|||
{},
|
||||
);
|
||||
|
||||
const NORMAL_CHARS_REGEX = /[a-z2689:.\-_+()*&^%><;"'}{~,]+/gim;
|
||||
const NORMAL_CHARS_REGEX = /^[a-z2689:.\-_+()*&^%><;"'}{~,]+$/i;
|
||||
|
||||
function containsOnlyNormalChars(text: string) {
|
||||
const match = text.match(NORMAL_CHARS_REGEX);
|
||||
return match && match[0].length === text.length;
|
||||
return NORMAL_CHARS_REGEX.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue