We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Validating Postal Codes
Validating Postal Codes
Sort by
recency
|
298 Discussions
|
Please Login in order to post a comment
write a function
^[1-9]\d{3,5}$ Explanation:
^: Start of the string. [1-9]: First digit must be in the range 1-9. \d{3,5}: Match 3 to 5 digits (to cover the range from 1000 to 999999). $: End of the string.
regex_integer_in_range = r'^[1-9][\d]{5}$'
regex_alternating_repetitive_digit_pair = r'(\d)(?=\d\1)'
Eventhough I got the anwer right, if you take the regex as a standard postal code pattern identfication, it does not fit the whole postcode system in th UK system, at least.