Browse Source
* location cell ref * extracted regex into initializer * extracted regex into initializer - part 2 * added PostcodeService to extract behavior * rubo * better test name * moved .delete.upcase to the PostcodeService classpull/724/head
J G
2 years ago
committed by
GitHub
13 changed files with 25 additions and 26 deletions
@ -0,0 +1,5 @@ |
|||||||
|
class PostcodeService |
||||||
|
def self.clean(postcode) |
||||||
|
postcode.encode("ASCII", "UTF-8", invalid: :replace, undef: :replace, replace: "").delete(" ").upcase |
||||||
|
end |
||||||
|
end |
@ -0,0 +1 @@ |
|||||||
|
POSTCODE_REGEXP = /^(([A-Z]{1,2}[0-9][A-Z0-9]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?[0-9][A-Z]{2}|BFPO ?[0-9]{1,4}|(KY[0-9]|MSR|VG|AI)[ -]?[0-9]{4}|[A-Z]{2} ?[0-9]{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i |
Loading…
Reference in new issue