From 8bba19cdb91b132d82ed9d1875c05d2e5fbfd6cc Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Thu, 2 Nov 2023 21:40:08 +0800 Subject: [PATCH] pref: add register name Japanese support --- src/utils/validate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 8bb81153..3cd3d919 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -11,9 +11,10 @@ export const isValidEmail = (email: string) => { return regex.test(email) } -// Match a username of 1 to 17 characters containing Chinese, English, numbers, underscores, or tildes +// 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_~]{1,17}$/ + 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}$/ return regex.test(name) }