diff --git a/web/lib/react/components/organization/user/update.tsx b/web/lib/react/components/organization/user/update.tsx index 0e326240d..e6ac30cd6 100644 --- a/web/lib/react/components/organization/user/update.tsx +++ b/web/lib/react/components/organization/user/update.tsx @@ -25,8 +25,20 @@ const generalSchema = yup .required('Name is required') .min(2, 'Name must be at least 2 characters') .matches( - /^[a-zA-Z\s'-]+$/, - 'Name can only contain letters, spaces, hyphens, and apostrophes' + /^[\p{L}\s.'-]+$/u, + 'Name can only contain letters, spaces, periods, hyphens, and apostrophes' + ) + .matches(/^\p{L}/u, 'Name must start with a letter') + .matches( + /^\p{L}[\p{L}\s.'-]*\p{L}$|^\p{L}$/u, + 'Name must end with a letter' + ) + .matches(/^(?!.*\s\s).*$/, 'Name cannot have consecutive spaces') + .matches(/^(?!.*\s[^\p{L}]).*$/u, 'Spaces must be followed by a letter') + .matches(/^(?!.*-[^\p{L}]).*$/u, 'Hyphens must be followed by a letter') + .matches( + /^(?!.*'[^\p{L}]).*$/u, + 'Apostrophes must be followed by a letter' ), email: yup.string().email().required() })