Giter Site home page Giter Site logo

Comments (6)

huwd avatar huwd commented on June 19, 2024 2

!? the santa claus postcode is real

from govuk-coronavirus-vulnerable-people-form.

brucebolt avatar brucebolt commented on June 19, 2024 1

When this was first implemented (for the Brexit EU Funding Form), we took the regex from https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation.

This seems to cover all formats of UK postcode, plus the BFPO addresses, non-geographic special cases and British Overseas Territories.

from govuk-coronavirus-vulnerable-people-form.

huwd avatar huwd commented on June 19, 2024

Humm this might be tough,
I remember reading this once:
https://github.com/mysociety/mapit/blob/f186a5dd13f71e63486d0ac792cd3bca8f72ebfc/mapit_gb/countries.py

from govuk-coronavirus-vulnerable-people-form.

huwd avatar huwd commented on June 19, 2024
SPECIAL_POSTCODES = (
    'ASCN1ZZ',  # Ascension Island
    'BBND1ZZ',  # BIOT
    'BIQQ1ZZ',  # British Antarctic Territory
    'FIQQ1ZZ',  # Falkland Islands
    'PCRN1ZZ',  # Pitcairn Islands
    'SIQQ1ZZ',  # South Georgia and the South Sandwich Islands
    'STHL1ZZ',  # St Helena
    'TDCU1ZZ',  # Tristan da Cunha
    'TKCA1ZZ',  # Turks and Caicos Islands
    'GIR0AA', 'G1R0AA',  # Girobank
    'SANTA1', 'XM45HQ',  # Santa Claus
)

from govuk-coronavirus-vulnerable-people-form.

NickColley avatar NickColley commented on June 19, 2024

as long as you're confident and have used the logic elsewhere, feel free to close :)

from govuk-coronavirus-vulnerable-people-form.

brucebolt avatar brucebolt commented on June 19, 2024

We could probably simplify the regular expression by removing the British Overseas Territories. If we don't already have it, we should probably have a test to check the following are all valid:

AA9A 9AA
A9A 9AA
A9 9AA
A99 9AA
AA9 9AA
AA99 9AA
BFPO 1
BFPO 9

Plus all of the above without a space.

from govuk-coronavirus-vulnerable-people-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.