1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(code) simplified regexs

This commit is contained in:
Sylvain 2022-05-04 10:03:09 +02:00
parent 048ed4b644
commit 51960782ee

View File

@ -33,8 +33,8 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
const { t } = useTranslation('shared');
// regular expression to validate the the input fields
const phoneRegex = /^((00|\+)[0-9]{2,3})?[0-9]{4,14}$/;
const urlRegex = /^(https?:\/\/)([\da-z.-]+)\.([-a-z0-9.]{2,30})([/\w .-]*)*\/?$/;
const phoneRegex = /^((00|\+)\d{2,3})?\d{4,14}$/;
const urlRegex = /^(https?:\/\/)([\da-z.-]+)\.([-a-z\d.]{2,30})([/\w .-]*)*\/?$/;
const { handleSubmit, register, control, formState, setValue } = useForm<User>({ defaultValues: { ...user } });
const output = useWatch<User>({ control });