Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
chore: remove special char from regex
Browse files Browse the repository at this point in the history
  • Loading branch information
behnaz-deriv committed Feb 28, 2024
1 parent 56b8ae0 commit cb09ef6
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export const affiliate_validation_regex = {
value.length <= 50,
phone: (value: string) => /^\+?\d+$/.test(value),
username: (value: string) => /^[A-Za-z0-9_]{3,20}$/.test(value),
password: (value: string) => /^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])[ -~]{6,50}$/.test(value),
password: (value: string) =>
/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?!.*\W)(?!.* ).{8,50}$/.test(value),
city: (value: string) =>
/^[\p{L}][\p{L}\s'.-]{0,49}$/u.test(value) &&
value.trim().length >= 2 &&
Expand Down Expand Up @@ -94,17 +95,14 @@ const phoneValidation = (input: string) => {
}
}
const passwordValidation = (input: string) => {
console.log('==', affiliate_validation_regex.password(input))
if (!input) return localize('_t_Password is required_t_')
else if (input.length < 8 || input.length > 50) {
else if (input.length < 8 || input.length > 50)
return localize('_t_You should enter 8-50 characters._t_')
} else if (
!affiliate_validation_regex.password(input) ||
!affiliate_validation_regex.non_empty_string(input)
) {
else if (!affiliate_validation_regex.password(input))
return localize(
'_t_Password should have lower and uppercase English letters with numbers._t_',
)
}
}
const postcodeValidation = (input: string) => {
if (!affiliate_validation_regex.postal_code(input))
Expand Down

0 comments on commit cb09ef6

Please sign in to comment.