Created
December 22, 2021 08:21
-
-
Save RobSchilderr/7467c00933d328bce33e1793b75bfa7b to your computer and use it in GitHub Desktop.
Common regular expressions for Dutch people, such as kvk number, iban, dutch identitycard
This file contains hidden or 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
const regexps = { | |
alpha: '[a-zA-Z .-]+', | |
alphaNumeric: '[a-zA-Z0-9À-ü ,.\'-]+', | |
sameChars: /^(?!.*(.)\1\1+)/i, | |
date: /^(?:(?:(?:[0]?[1-9]|1[0-9]|2[0-8])-(?:(0)?[1-9]|1[0-2])|(?:29|30)-(?:(0)?[13-9]|1[0-2])|31-(?:(0)?[13578]|1[02]))-[1-9]\d{3}|29-(0)?2-(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00))$/, | |
kvkNumber: /^[0-9]{8}$/, | |
btwNumber: /^[A-Za-z]{2}[0-9]{9}[A-Za-z][0-9]{2}$/, | |
phoneMobile: /(^(\(?(0031|0|\+31)\)?){1})( ?-?(6){1}\)?)(( ?|-)?[1-9]( ?|-)?){1}(( ?|-)?[0-9]( ?|-)?){7}$/, | |
phoneFixedThreeDigits: /(^(\(?(0031|0|\+31)\)?){1})( ?-?([0-9]){3}\)?)(( ?|-)?[0-9]( ?|-)?){6}$/, | |
phoneFixedFourDigits: /(^(\(?(0031|0|\+31)\)?){1})( ?-?([0-9]){2}\)?)(( ?|-)?[0-9]( ?|-)?){7}$/, | |
phoneFixedExceptions: /^( ?\(?((0)|(\+31)|(0031))\)? ?){1}?(| |-| ?\([0-9]*?\) ?)(800|900|906|909){1}.*$/, | |
phoneFixedMobileException: /^( ?\(?((0)|(\+31)|(0031))\)? ?){1}?(| |-| ?\([0-9]*?\) ?)(800|900|906|909|6){1}.*$/, | |
zipCode: /^[1-9][0-9]{3}[ -\\.]?[A-Za-z]{2}$/, | |
houseNumber: /^[0-9]{0,5}$/, | |
houseNumberExtension: /^(?!\s|-)(((?!\s{2})[A-Za-z0-9\s-])*)$/, | |
iban: /^([A-Z]{2})(\d{2})([A-Z\d]+)$/, | |
driversLicense: /^(?!0{10})([0-9]{10})$/i, | |
identityCard: /^[a-zA-Z]{2}(?!0{7})([a-zA-Z0-9]{6}[0-9]{1})$/i, | |
passport: /^[a-np-z]{2}[a-np-z0-9]{6}[0-9]$/i, | |
email: /^(([^<>()[\]\\.,;:\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 default regexps; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear @RobSchilderr , hope the Regex-ies for Nederland didn't change since then. Anyway, thanks a lot !
BTW, I think for IBAN, the regex might be : /^NL[0-9]{2}[A-z0-9]{4}[0-9]{10}$/'