aboutsummaryrefslogtreecommitdiff
path: root/src/constants/regex.ts
diff options
context:
space:
mode:
authorHusam Salhab <47015061+hsalhab@users.noreply.github.com>2020-08-06 16:11:11 -0400
committerGitHub <noreply@github.com>2020-08-06 16:11:11 -0400
commit8e62aaa6dc7c61dcba7b9313d0aadcf7f46ce41b (patch)
tree02a92b5f97a7e8d98285b2f50d1524407dc6ebba /src/constants/regex.ts
parent1279249ee9355f88913578f51e3b0bf7d99672f6 (diff)
[TMA-49] Add static boxes (#28)
* adds BigInput component * removes dummy fields * adds website TaggInput * adds handleWebsiteUpdate() * added website regex * added form * added handleFocusChange() * sends website in request * moves input components to onboarding * allow for empty string in website regex * adds bio regex * adds bio field * added bioRef for focusChange * added react-native-datepicker * moves TaggInput * add imports * add TaggDatePicker * fix typescript interface * remove TouchableComponent type * added date and selectpicker * added date and dropdown * adds momentjs * remove warnings from optional fields * remove debugging console.log * Removes isValidBirthdate * moves @types/react-native-datepicker to devdepnden * update package versioning * fix positioning * added checkpoint * update button styling * update placeholder * linting and other fixes
Diffstat (limited to 'src/constants/regex.ts')
-rw-r--r--src/constants/regex.ts22
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}$/;