BUG fix: username jp support

This commit is contained in:
KUN1007 2023-11-02 21:43:55 +08:00
parent 8bba19cdb9
commit 43ec531a40

View file

@ -13,8 +13,7 @@ export const isValidEmail = (email: string) => {
// Match a username of 1 to 17 characters containing Chinese, English, Japanese, numbers, underscores, or tildes
export const isValidName = (name: string) => {
const regex =
/^[\u4E00-\u9FFFa-zA-Z0-9_~\u3040-\u30FF\u31F0-\u31FF\u3200-\u33FF\u3400-\u4DBF\u20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\xF900-\xFAFF]{1,17}$/
const regex = /^[\p{L}\p{N}~_]{1,17}$/u
return regex.test(name)
}