Skip to content

Commit 73037e5

Browse files
nschonnijzaefferer
authored andcommitted
Split out postcodeUK
1 parent 41671db commit 73037e5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/additional/additional.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333

3434
}());
3535

36-
// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
37-
jQuery.validator.addMethod('postcodeUK', function(value, element) {
38-
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
39-
}, 'Please specify a valid UK postcode');
40-
4136
// TODO check if value starts with <, otherwise don't try stripping anything
4237
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
4338
return jQuery(value).text().length >= param;

src/additional/postcodeUK.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
2+
jQuery.validator.addMethod('postcodeUK', function(value, element) {
3+
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
4+
}, 'Please specify a valid UK postcode');

0 commit comments

Comments
 (0)