Wildcard-range rules

A wildcard-range rule matches postcodes that fall within a range. In these rules, the 'from' and 'to' sides of the range are partial postcodes, defined using wildcard characters.


As a wildcard-range rule is a combination of the wildcard and range rule types, it is recommended you review these rules before using wildcard-ranges as many of the same principles and constraints apply.

Take the following example of a wildcard-range rule for a Range in the United Kingdom:

BS1 1*-BS1 5*

This rule will match any postcodes that start BS1 1 to BS1 5. Postcodes outside of this range will not be matched so for example BS1 6AA will not match this rule.

Valid usage

In order to write a valid wildcard range rule you should follow the same guidelines outlined in the wildcard and range rule documentation. To summarise:

  • Both sides of the range should be a valid format for the country the Range is for.

  • Both sides of the range should be the same format (e.g. BS5*-BS8* is valid whereas BS5*-BS10* is not).

  • The wildcard character must come at the end of each side of the rule (e.g. BS5*-BS8* is valid whereas BS*5-BS*8 is not).

  • There can only be one wildcard character on each side of the range (e.g. BS5*-BS8* is valid whereas BS**-BT** is not).

Common use-cases

Wildcard-range rules are very useful for alphanumeric postcode formats. They allow you to easily create ranges between either numbers or letters. For example, in the rule below the range spans between numbers:

BS1*-BS5*

And in the following example, the rule spans between letters:

BS1 8A*-BS 18P*

Note that it is the first character that is different between the ‘from’ and ‘to’ sides of the range that is used to compute whether a given postcode falls within the range. The wildcard character should be positioned just after this character.

Wildcard-ranges are unsuited for use with numerical or pseudo-numerical postcode formats. These formats are better expressed as regular range rules.

You should use wildcard-range rules when you want to target a set of alphanumeric within a given range.

You should avoid using wildcard-range rules when dealing with numeric or pseudo-numerical postcodes and opt instead for a range type rule for this format types.


Related articles: