aboutsummaryrefslogtreecommitdiff
path: root/src/constants/regex.ts
diff options
context:
space:
mode:
authorGeorge Rusu <george@tagg.id>2021-05-25 13:35:05 -0700
committerGeorge Rusu <george@tagg.id>2021-05-25 13:35:05 -0700
commit4089ccdc05ffa5e02c6e0be717626cbdc631b8f2 (patch)
treee279bfe3b33da17f85fc3ca83cbb1f338e05e4b3 /src/constants/regex.ts
parenta5ef509d2a1f79d85c76ee766dabe96acac2a989 (diff)
parent7f991eef32475165f819dc8b666c5763f0021696 (diff)
Merge
Diffstat (limited to 'src/constants/regex.ts')
-rw-r--r--src/constants/regex.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/constants/regex.ts b/src/constants/regex.ts
index 7de36492..61523203 100644
--- a/src/constants/regex.ts
+++ b/src/constants/regex.ts
@@ -1,7 +1,8 @@
/**
* The email regex has complex constraints compliant with RFC 5322 standards. More details can be found [here](https://emailregex.com/).
*/
-export const emailRegex: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+export const emailRegex: RegExp =
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
/**
* The password regex has the following constraints
@@ -11,7 +12,8 @@ export const emailRegex: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@
* - at least one uppercase letter ([A-Z])
* - at least one special character ([^a-zA-z0-9])
*/
-export const passwordRegex: RegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,120}$/;
+export const passwordRegex: RegExp =
+ /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,120}$/;
/**
* The username regex has the following constraints
@@ -33,7 +35,8 @@ export const nameRegex: RegExp = /^[A-Za-z'\-,. ]{2,20}$/;
* - 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})$/;
+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