Skip to main content
A regular expression (regex) is a pattern that describes what a value should look like. Use this rule when a field must follow an exact format, like a 6-digit postcode or a 10-digit mobile number.

How it works

You add one or more fields. For each field you set a pattern and choose when to block:
  • Matched: block checkout when the value matches the pattern. Use this for things you don’t want, such as numbers in a name.
  • Unmatched: block checkout when the value doesn’t match the pattern. Use this for a format the value must follow, such as a postcode.
Empty fields are not checked. Matching ignores upper and lower case.
Matched blocks John2 because it contains a number. Unmatched blocks 11001 because it isn't a 6-digit postcode.

Set up the rule

1

Select the fields

Under Add validation to these fields, click the box and tick the fields to check. Each field gets its own card.
2

Enter a pattern

In the field’s card, type a pattern in Custom Regular Expression, or click the presets button and choose one of the ready-made patterns. Choosing a preset also sets When for you.
3

Choose when to block

Under When, choose Matched or Unmatched.
4

Choose shipping or billing

For address fields, tick Shipping address, Billing address or both.
5

Write the message

Under Message to display in the field’s card, write what the customer sees. English is required for each field.

Fields you can check

Ready-made patterns

More example patterns

Not sure how to write a pattern? Describe what you need to an AI assistant, or contact us with your example and we’ll help you write it.
Test every pattern with the Testing status first. A pattern that is too strict can block real customers. If a pattern isn’t valid, the app skips that field instead of blocking checkout.

Other settings

This rule also has the Countries, Rule status and Checkout behavior settings described in Common rule settings.