requires = IS_MATCH('^[A-Z]\d[A-Z][\- ]?\d[A-Z]\d$',error_message='not a zip code')
On Monday, 24 September 2012 20:13:03 UTC-5, Don_X wrote: > > Hello web2py users : > > Validating if numbers or decimals are entered on a form seem to be very > straight forward and easy enough ! whether it is a phone number or a US > postal code : > Like for example a US postal code would go like this : > > requires = IS_MATCH('^\d{5}(-\d{4})?$',error_message='not a zip code') >> >> > however, a Canadian postal code on the other hand is another story : > > a Canadian postal code is configured like this : Letter#Letter #Letter# > an example would be : A1B 2C3, or A1B-2C3, or again A1B2C3 : All these 3 > postal codes are the same and equivalent in the Canadian postal code scheme > ! > > How would I go about validating such input into a field on a form in > python / web2py ??? > > it seems that there is no easy simple way to do this ! ... is there a set > of alphabetic characters only .... without numbers in python / web2py ? I > only found alpha numeric characters that take numbers as characters !! and > it is not what I want !! .. > > Please help ! > > thank you > > Don > > --