- Update regex pattern to use Unicode properties for better internationalization
This commit is contained in:
1 parent
fa0f4dd6ec
commit
d62a4f12fa
1 file changed
+2
-9
@@ -7,18 +7,11 @@ const nameSchema = joi
|
|||||||
.string()
|
.string()
|
||||||
.max(50)
|
.max(50)
|
||||||
.trim()
|
.trim()
|
||||||
.pattern(/^(?=.*[\p{L}\p{Sc}])[\p{L}\p{Sc}\s']+$/u, {
|
.pattern(/^[\p{L}\p{M}''\- ]+$/u)
|
||||||
name: "name.containsLetterOrSymbol",
|
|
||||||
})
|
|
||||||
.pattern(/^[\p{L}\p{Sc}\s']+$/u, {
|
|
||||||
name: "name.validCharacters",
|
|
||||||
})
|
|
||||||
.messages({
|
.messages({
|
||||||
"string.empty": "Name is required",
|
"string.empty": "Name is required",
|
||||||
"string.max": "Name must be less than 50 characters",
|
"string.max": "Name must be less than 50 characters",
|
||||||
"string.pattern.name": "Name must contain at least 1 letter or currency symbol",
|
"string.pattern.base": "Name must contain only letters, spaces, apostrophes, or hyphens"
|
||||||
"string.pattern.base.validCharacters":
|
|
||||||
"Can only contain letters, spaces, apostrophes, and currency symbols",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const passwordSchema = joi
|
const passwordSchema = joi
|
||||||
|
|||||||
Reference in new issue
Block a user