Skip to main content
All CollectionsFAQs
How do I ensure postcode are correctly formatted?
How do I ensure postcode are correctly formatted?

Whether you are wanting to reject postcodes without a space or force them to have one, this guide is for you.

Korey Abbott avatar
Written by Korey Abbott
Updated over 2 years ago

If you're receiving data and it's not always standardised you can have some issues with validation and forwarding to clients.

Postcodes seem to come up in this area a lot, especially when we're talking about the space. So, to space or not to space?

Create a Rule group to check for the space

If you want to check for a space in your post code data, you can use a custom regex rule group.

/^[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}$/i

You simply enter this into your value part of the custom regex as shown below.

This rule checks if a postcode value contains a space.

If you are creating the rule group in the campaign, it will ask you if you would like to add multiple values to this rule. Please select no.

With this, you can either accept ones with a space or reject them, whatever you need to do.

Just remember to name the rule group and test with some dummy lead submission.

Here's a test lead rejecting the lead as the postcode value contains a space, so we can see this is working.

Reformatting Data Forwarded From Your Campaign

Databowl's forwarders allow you to apply a reformat the data as you are sending it.

When creating or editing your forwarder, under the 'mappings' section, add or find the field you want to reformat and click the blue icon on the right side.

Then, from the 'Type' dropdown, click 'Regex Replace'.

Removing a Space

To remove a space, your regex value is:

\s

Type '1' in the priority box

For the reformatter 'Replace With' use the below

$1

Click '+ Add' and you have now added your Regex replace reformatter.

Click done to confirm your changes.

Adding a Space

To add a space, your regex value is:

/^([A-Z]{1,2}[0-9]{1,2})([0-9][A-Z]{2})$/i

Type '1' in the priority box

Then, type $1 $2 in the 'Replace With' box

For the reformatter 'Replace With' use the below

$1 $2

This should look like this:

Click '+ Add' and you have now added your Regex replace reformatter.

Click done to confirm your changes.

Test Your forwarder

Go through to test the forwarder and enter a postcode format you don't want and view the body to see how the data is now sent.


πŸš€ Need More assistance?

If you're stuck or if this isn't something you or your team is comfortable with, then please open a new chat/ticket (chat icon in the bottom right of the screen) or email support@databowl.com.

We're here to assist with any questions you have, and if required we can quote on actioning work like this for as part of our Marketing Services.

Did this answer your question?