Skip to content

Commit

Permalink
[#65] Import postcode regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Dec 1, 2023
1 parent be1911d commit 6748489
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/registry/address/edit-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import {IntlShape} from 'react-intl';
import {z} from 'zod';

import {buildCommonSchema} from '@/registry/validation';
import {POSTCODE_REGEX} from '../postcode/constants';

// Constraints taken from the BRK API (apart from postcode which comes from our postcode component)
const addressSchema = z.object({
postcode: z.string().regex(/^[1-9][0-9]{3} ?(?!sa|sd|ss|SA|SD|SS)[a-zA-Z]{2}$/),
postcode: z.string().regex(new RegExp(POSTCODE_REGEX)),
houseNumber: z.string().regex(/^\d{1,5}$/),
houseLetter: z.string().regex(/^[a-zA-Z]$/),
houseNumberAddition: z
Expand Down

0 comments on commit 6748489

Please sign in to comment.