Below is a list of RegExes we’ve created in the past in alphabetical order:
-
Affirmative: Chat visitors writes anything that starts with y or Y, 5 letters to show affirmation
-
^[yY].{1,5}\b
-
-
credit_card: Preset in dashboard
-
CVV
-
(CVV|CVV\s)\d{3}
-
-
DOB 1: Date of birth examples YYYY-MM-DD, YYYYMMDD
-
^\d{4}[.|-|\/]\d{2}[.|-|\/]\d{2}|^\d{8}
-
-
DOB 2: Date of birth examples DD/MM/YYYY
-
\d{1,2}[.|\-|\/]\d{1,2}[.|\-|\/]\d{2,4}\b
-
- email: Preset in dashboard
- IBAN: Preset in dashboard
-
mobileNumber: Example of mobile number with or without prefix
-
^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}([-\s.]?[0-9]){4,10}$
-
-
Negative: Chat visitors writes anything that starts with n or N, 5 letters to show negation
-
^[nN].{1,5}\b
-
-
orderNumber: Example: 8 or 16 digits, can include letters and / or numbers
-
[0-9a-zA-Z]{8}|[0-9a-zA-Z]{16}
-
-
PIN: 4-digit pin. Numbers only.
-
(\s{1})?\d{4}
-
-
phoneNumber: Example of phone number (US, CA such as +1 NXX-NXX-XXXX or 01 NXX-NXX-XXXX or 001 NXX-NXX-XXXX)
-
(\d{0,3})?[ ()]?(?:[- ()]?\d[- ()]?){7}
-
-
URL: universal URL regEx
-
((http|https)://)?[a-zA-Z0-9./?:-=#]+.([a-zA-Z]){2,6}([a-zA-Z0-9.&/?:-=#])*
-
-
ZIP code: Example of ZIP code (Canada, such as A2B 3C4)
-
(\d{5}([ -]\d{4})?|[A-Z]\d[A-Z][ -]?\d[A-Z]\d)
-