From 3d6b1182faa8f6d060a69cd8c94cf735f366da1a Mon Sep 17 00:00:00 2001 From: mitra Date: Wed, 22 May 2024 16:53:53 +0800 Subject: [PATCH 1/4] fix: :safety_vest: update the regex for first and last name validation --- src/constants/validation.constants.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants/validation.constants.ts b/src/constants/validation.constants.ts index 258c030..ddd69eb 100644 --- a/src/constants/validation.constants.ts +++ b/src/constants/validation.constants.ts @@ -147,14 +147,14 @@ export const patterns = { */ letterSymbols: /^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/, /** - * @regex /^(?!.*\s{2,})[\p{L}\s'.-]{2,50}$/u - * @description This pattern matches any string that contains 2-50 characters, starts and ends with valid characters (letters, whitespace, period, single quote, or hyphen). + * @regex /^(?!.*\s{2,})(?!\s)[\p{L}\s'.-]{1,50}(?<|]+/ * @description This pattern matches any string that contains any of these characters: `~!@#$%^&*)(_=+[}{\]\\/";:?><| From dcfd5fd025bea4bcd8e490f3cfb30d5afb879c3f Mon Sep 17 00:00:00 2001 From: mitra Date: Wed, 19 Jun 2024 14:50:53 +0800 Subject: [PATCH 2/4] fix: :bug: remove unsupported regex in lower version of ios --- src/constants/validation.constants.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/constants/validation.constants.ts b/src/constants/validation.constants.ts index ddd69eb..d631b01 100644 --- a/src/constants/validation.constants.ts +++ b/src/constants/validation.constants.ts @@ -147,14 +147,14 @@ export const patterns = { */ letterSymbols: /^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/, /** - * @regex /^(?!.*\s{2,})(?!\s)[\p{L}\s'.-]{1,50}(?<|]+/ * @description This pattern matches any string that contains any of these characters: `~!@#$%^&*)(_=+[}{\]\\/";:?><| From 877a11ab87a00ba3b08fada8fe480b150250740c Mon Sep 17 00:00:00 2001 From: mitra Date: Wed, 19 Jun 2024 14:56:00 +0800 Subject: [PATCH 3/4] feat: :sparkles: update docs for validation --- utils-docs/docs/Constants/validation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils-docs/docs/Constants/validation.md b/utils-docs/docs/Constants/validation.md index 6210ca5..84a0617 100644 --- a/utils-docs/docs/Constants/validation.md +++ b/utils-docs/docs/Constants/validation.md @@ -216,14 +216,14 @@ letterSymbols: /^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/; ### name -This pattern matches any string that contains **2-50** characters, starts and ends with valid characters (letters, whitespace, period, single quote, or hyphen). +This pattern matches any string that contains **1-50** characters, starts and ends with valid characters (letters, whitespace, period, single quote, or hyphen) and can not be single space. ```JS // @example ValidationConstants.patterns.name.test("John Doe") // @example ValidationConstants.patterns.name.test("John-Doe") // @example ValidationConstants.patterns.name.test("John O'Doe") // @example ValidationConstants.patterns.name.test("John O. Doe") -name: /^(?!.*\s{2,})[\p{L}\s'.-]{2,50}$/u; +name: /^(?!.*\s{2,})(?!\s)[\p{L}\s'.-]{1,50}$/u; ``` ### general From 6f1c9e1b9a2f5a827e82925406b92fdc5d928d7d Mon Sep 17 00:00:00 2001 From: mitra-deriv <64970259+mitra-deriv@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:53:47 +0800 Subject: [PATCH 4/4] Update utils-docs/docs/Constants/validation.md Co-authored-by: Shayan Khaleghparast <100833613+shayan-deriv@users.noreply.github.com> --- utils-docs/docs/Constants/validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils-docs/docs/Constants/validation.md b/utils-docs/docs/Constants/validation.md index 84a0617..f6f9716 100644 --- a/utils-docs/docs/Constants/validation.md +++ b/utils-docs/docs/Constants/validation.md @@ -216,7 +216,7 @@ letterSymbols: /^[A-Za-z]+([a-zA-Z.' -])*[a-zA-Z.' -]+$/; ### name -This pattern matches any string that contains **1-50** characters, starts and ends with valid characters (letters, whitespace, period, single quote, or hyphen) and can not be single space. +This pattern matches any string that contains **1-50** characters, starts and ends with valid characters (letters, whitespace, period, single quote, or hyphen) and can not be single space or have two sequential spaces. ```JS // @example ValidationConstants.patterns.name.test("John Doe")