A wildcard rule allows for the creation of rules than can match any character from a given position within a postcode.
An asterisk (*) character is used to define a wildcard rule.
In the example below, the postcode for the destination address must start with BS1 followed by a space and then any other combination of letters and numbers in order for this Region to be considered a match:
In order to be considered valid, the section of the postcode before the wildcard (*) character must match a valid format for the country that this Region has been created for. The following example would fail validation for a Region set to the United Kingdom as it is not a valid UK postcode:
The rule must also contain only one wildcard character and this must come at the end of the rule. For example, in the rule below, two wildcard characters have been used making the rule invalid:
Finally the wildcard character must appear at the end of the rule. The following rule would be considered invalid:
Wildcard rules are particularly useful for alphanumeric postcodes and can be used to target both wide and narrow areas depending on the placement of the wildcard character. For example, this rule:
Will target any postcode in the city of Bristol, United Kingdom. Whereas this rule:
Will target only properties within a specific postcode district of the city.
With wildcard rules, the placement of spaces is important and can affect the matches that a rule will generate. Take the following rule as an example:
Matches for this rule would include both BS1 1SB and BS11 1SB. However, consider the next rule:
Note the space after the 1. The matches for this rule would include BS1 1SB`
but would not include BS11 1SB. In UK postcodes, the space is a part of the format and is taken into account when wildcard rules are defined. Depending on how specific you wish to make your wildcard rule, you should be careful to use or omit the space - adding a space will result in a more specific rule and omitting it will create a broader rule with more results.
Whilst wildcard rules can be used with numeric and pseudo-numeric postcodes, the same results can be achieved in much clearer fashion using range rule types.
✅You should use a wildcard rule when you want to target a narrow or broad set of alphanumeric postcodes.
❌You should avoid using wildcard rules when dealing with numeric or pseudo-numerical postcodes and opt instead for a range type rule for this format types.
Updated on: 23/11/2022