[FIX] modify regex to accept cyrillic characters in page name (#4741)
* modify regex to accept cyrillic characters in page name * Remove separator regex in order to allow all utf characters * Disallow special characters
This commit is contained in:
parent
50e5807e8d
commit
9d6247672a
|
|
@ -110,11 +110,13 @@ export const flashElementById = (id: string) => {
|
|||
};
|
||||
|
||||
export const resolveAsSpaceChar = (value: string, limit?: number) => {
|
||||
const separatorRegex = /[^\w\s]/;
|
||||
// ensures that all special characters are disallowed
|
||||
// while allowing all utf-8 characters
|
||||
const removeSpecialCharsRegex = /`|\~|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\+|\=|\[|\{|\]|\}|\||\\|\'|\<|\,|\.|\>|\?|\/|\""|\;|\:|\s/;
|
||||
const duplicateSpaceRegex = /\s+/;
|
||||
return value
|
||||
.split(separatorRegex)
|
||||
.join("")
|
||||
.split(removeSpecialCharsRegex)
|
||||
.join(" ")
|
||||
.split(duplicateSpaceRegex)
|
||||
.join(" ")
|
||||
.slice(0, limit || 30);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user