diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-24 17:23:58 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-24 17:23:58 -0400 |
commit | 0eb78b5c2d0731f0110cb7286786440ed19c4861 (patch) | |
tree | 76cd55c91f701e1fca16d3fe68d4706b5604ff84 /src/constants/regex.ts | |
parent | c634270d5466bf24741f1f4423696af373f88c03 (diff) | |
parent | 53f624423fa8f758da5542e62704b59fa53316ea (diff) |
Merge branch 'master' into tma891-tag-with-photo-tap
Diffstat (limited to 'src/constants/regex.ts')
-rw-r--r-- | src/constants/regex.ts | 9 |
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 |