We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26dab0f commit fcaab4aCopy full SHA for fcaab4a
2 files changed
index.js
@@ -1,8 +1,8 @@
1
"use strict";
2
3
-var validationRegex = /^[a-z]([a-z]\d[a-z]|\d[a-z]|\d|\d\d|[a-z]\d|[a-z]\d\d)\s*?\d[a-z]{2}$/i,
+var validationRegex = /^[a-z]{1,2}\d[a-z\d]?\s*?\d[a-z]{2}$/i,
4
incodeRegex = /\d[a-z]{2}$/i,
5
- validOutcodeRegex = /^[a-z]([a-z]\d[a-z]|\d[a-z]|\d|\d\d|[a-z]\d|[a-z]\d\d)$/i,
+ validOutcodeRegex = /^[a-z]{1,2}\d[a-z\d]?$/i,
6
areaRegex = /^[a-z]{1,2}/i,
7
districtSplitRegex = /^([a-z]{1,2}\d)([a-z])$/i,
8
sectorRegex = /^[a-z][a-z\d]{1,3}\s*?\d/i,
tests/data/validation.json
@@ -40,6 +40,14 @@
40
"base" : "EH1 JS",
41
"expected" : false
42
},
43
+ {
44
+ "base" : "EH1JS",
45
+ "expected" : false
46
+ },
47
48
+ "base" : "EH 1JS",
49
50
51
{
52
"base" : "BT35 8GE",
53
"expected" : true
0 commit comments