diff options
Diffstat (limited to 'src/constants/regex.ts')
-rw-r--r-- | src/constants/regex.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/constants/regex.ts b/src/constants/regex.ts index 40c82691..c380ee30 100644 --- a/src/constants/regex.ts +++ b/src/constants/regex.ts @@ -26,3 +26,25 @@ export const usernameRegex: RegExp = /^[a-zA-Z0-9_.]{6,30}$/; * - match alphanumerics, apostrophes, commas, periods, dashes, and spaces */ export const nameRegex: RegExp = /^[A-Za-z'\-,. ]{2,20}$/; + +/** + * The website regex has the following constraints + * - starts with http:// or https:// + * - min. 2 chars, max. 50 chars on website name + * - match alphanumerics, and special characters used in URLs + */ +export const websiteRegex: RegExp = /^$|^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,50}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]{0,35})$/; + +/** + * The website regex has the following constraints + * - max. 150 chars for bio + * - match alphanumerics, and special characters used in URLs + */ +export const bioRegex: RegExp = /^$|^[A-Za-z'\-,. ]{1,150}$/; + +/** + * The gender regex has the following constraints + * - max. 20 chars for bio + * - match alphanumerics, hyphens, and whitespaces + */ +export const genderRegex: RegExp = /^$|^[A-Za-z\- ]{2,20}$/; |