hof 21.2.0-postcode-lookup-beta.5 → 21.2.0-postcode-lookup-beta.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -343,7 +343,7 @@ module.exports = config => {
|
|
343
343
|
saveValues(req, res, callback) {
|
344
344
|
const step = req.query.step;
|
345
345
|
if (step === 'postcode') {
|
346
|
-
postcode = req.form.values[`${addressFieldNamePrefix}-postcode`]?.replace(/[^\w]+/g, '$1 $2');
|
346
|
+
postcode = req.form.values[`${addressFieldNamePrefix}-postcode`]?.replace(/[^\w]+/g, '').replace(/^(.*)(\d)/, '$1 $2');
|
347
347
|
this.clearAddressFieldValues(req);
|
348
348
|
return this.postcode(req, res, err => {
|
349
349
|
if (err) {
|
@@ -180,7 +180,7 @@ module.exports = Validators = {
|
|
180
180
|
|
181
181
|
postcodeValidation(value) {
|
182
182
|
// eslint-disable-next-line max-len
|
183
|
-
return Validators.regex(value, /^(([GIRgir] ?[ ]*0[ ]*[Aa]{2}[ ]*)|((([A-Za-z][ ]*[0-9]{1,2}[ ]*)|(([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9][ ]*[0-9]?)[ ]*|(([A-Za-z][ ]*[0-9][ ]*[A-Za-z][ ]*)|([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9]?[ ]*[A-Za-z][ ]*))))[^\w]*?[ ]*[0-9][ ]*[A-Za-z][ ]*[A-Za-z][ ]*))$/);
|
183
|
+
return Validators.regex(value, /^[^\w]*(([GIRgir] ?[ ]*0[ ]*[Aa]{2}[ ]*)|((([A-Za-z][ ]*[0-9]{1,2}[ ]*)|(([A-Za-z][^\w]*[ ]*[A-Ha-hJ-Yj-y][^\w]*[ ]*[0-9][^\w]*[ ]*[0-9]?)[ ]*|(([A-Za-z][ ]*[0-9][ ]*[A-Za-z][ ]*)|([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9]?[ ]*[A-Za-z][ ]*))))[^\w]*?[ ]*[0-9][^\w]*[ ]*[A-Za-z][^\w]*[ ]*[A-Za-z][ ]*)[^\w]*)$/);
|
184
184
|
}
|
185
185
|
|
186
186
|
};
|