pauloabmiranda
2/6/2014 - 2:45 PM

portuguese regexp forms validation

portuguese regexp forms validation

// 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])$/);