# Country rules

> Set a postal-code and house-number rule for each country in Checkout Address Validator for Shopify, or write your own rule as a regular expression.

The **Country rules** section on the Overview lists the countries you sell to: the countries in your shipping zones that belong to an active market. Each row shows what that country requires, and **Custom** marks the countries you changed.

If the list is empty, add a shipping zone or a market in your Shopify settings, then reload the page.

## The defaults

| Field            | Default                                                                                                                                               |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Postal code**  | Required where the country's address format requires one. See [Postal codes](/docs/checkout-address-validator/postal-codes).                          |
| **House number** | Required in every country except the ones listed in [House numbers](/docs/checkout-address-validator/house-numbers#where-a-house-number-is-required). |

Addresses from countries that aren't in the list use the default house-number rule.

## Changing a country

<Steps>
<Step>
### Open the country

Select the country in the list.
</Step>

<Step>
### Choose its rule

<Definitions>
<Definition title="Postal code">
Turn on **Require a postal code**. You can do this only where the country uses postal codes but doesn't require
them.
</Definition>

<Definition title="House number">
Choose **Required**, **Not required** or **Use my own rule**.
</Definition>
</Definitions>
</Step>

<Step>
### Save

Select **Done**, then **Save** in the bar at the top. Checkout uses the new rule after you save.
</Step>
</Steps>

To undo your changes for a country, open it and select **Use the default**, then **Save**.

![Country rule for Germany with the postal code and house number options](/products/checkout-address-validator/docs/en/country-rule.webp)

## Your own rule

**Use my own rule** replaces the built-in digit check with your own pattern. A pattern is a JavaScript regular expression. It's matched against address line 1 and line 2 separately, and the address passes when either line matches. It's case-sensitive, and [parcel lockers and P.O. boxes](/docs/checkout-address-validator/parcel-lockers-and-po-boxes) still pass without matching.

| Pattern  | The line passes when it                    |
| -------- | ------------------------------------------ |
| `\d\s*$` | ends in a number                           |
| `^\d`    | starts with a number                       |
| `\d{2,}` | contains a number with at least two digits |

`\d` matches only the digits 0 to 9, so a pattern is stricter than the built-in check for addresses in other scripts.

If a pattern isn't valid, the editor shows an error and **Done** stays unavailable until you fix it.

![Own rule for Germany with a regular expression pattern](/products/checkout-address-validator/docs/en/own-rule.webp)