The following characters are permitted according to chapter 1.5.4 of the product manual:
----------------------------------------------------------------------- | Component | Position | Allowed characters | ----------------------------------------------------------------------- | Routing Keys | 1 | A,C,D,E,F,H,K,N,P,R,T,V,W,X,Y | ----------------------------------------------------------------------- | Routing Keys | 2 | 0-9 | ----------------------------------------------------------------------- | Routing Keys | 3 | 0-9 with the exception of W for D6W | ----------------------------------------------------------------------- | Unique Identifier | 4 | 0-9, A,C,D,E,F,H,K,N,P,R,T,V,W,X,Y | ----------------------------------------------------------------------- | Unique Identifier | 5 | 0-9, A,C,D,E,F,H,K,N,P,R,T,V,W,X,Y | ----------------------------------------------------------------------- | Unique Identifier | 6 | 0-9, A,C,D,E,F,H,K,N,P,R,T,V,W,X,Y | ----------------------------------------------------------------------- | Unique Identifier | 7 | 0-9, A,C,D,E,F,H,K,N,P,R,T,V,W,X,Y | -----------------------------------------------------------------------
Each routing key must contain a letter and two digits, except for ONE specific situation, which is the D6W code.
Therefore, codes starting with A5W , C6W , V0W are not valid.
According to chapter 1.5.1 Recommendations for Storage and Presentation
- Eircode should always be stored as one line of seven uppercase characters in an IT system, i.e. A65F4E2.
- Eircode should always be represented in uppercase as two parts, separated by a space, to stationary, mail, computer forms, etc., i.e. A65 F4E2 and never A65F4E2.
Codes stored in the database should not be shared by space or dash , should be divided, but only into space and only for display.
Assuming the correct regular expression should look like this:
/([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}/
online tester regex
Ericode Guide