Last active
September 24, 2015 13:48
-
-
Save pauloabmiranda/8845518 to your computer and use it in GitHub Desktop.
portuguese regexp forms validation
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
// validate email, portuguese mobile, dates, and portuguese postal code | |
email.match( /([0-9a-zA-Z]+[\-._+&])*[0-9a-zA-Z]+@([\-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}/ ); | |
portuguese_mobile.match( /^([3]\d{8})|([2]\d{8})|([9][1|2|3|4|6]\d{7})$/ ); | |
date.match( /(\d{4}|(0[1-9]|[12][0-9]|3[01]))[\s\-\/](0[1-9]|1[012])[\s\-\/]((\d{4})|(0[1-9]|[12][0-9]|3[01]))/ ); | |
portuguese_postal_code.match( /^\d{4}(-\d{3})?$/ ); | |
day.match(/^(0[1-9]|[12][0-9]|3[01]|[1-9])$/); | |
month.match(/^(0[1-9]|1[012]|[1-9])$/); | |
year.match(/^([12][09][0-9][0-9])$/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment