Created
April 21, 2022 07:41
-
-
Save thetminko/011576252b856c7e04c4a24454d0d334 to your computer and use it in GitHub Desktop.
Regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Regex = { | |
POSTAL_CODE: /^[0-9]{6}$/, | |
ADDRESS_FLOOR: /^[0-9]{1,2}[a-zA-Z]?$/, | |
ADDRESS_UNIT: /^[0-9][a-zA-Z0-9]{1,4}$/, | |
CONTACT_NUMBER: /^(9[0-8]|[368][0-9])[0-9]{6}$/, | |
LAND_LINE_NUMBER: /^[36][0-9]{7}$/, | |
MOBILE_NUMBER: /^(9[0-8]|8[0-9])[0-9]{6}$/, | |
// RFC 5322 | |
EMAIL: /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/, | |
PEOPLE_NAME: /^[a-zA-Z @\-–/().,'’]+$/, | |
BASE_STRING: /^[a-zA-Z\s\d!@#$%^&*()\-–_+=\[\]{};:'"’\/\\?.,<>`~]*$/ | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment