In this tutorial, we explain how to include regular expressions in validation rules, an advanced setting that allows AI to correctly identify product names, stores, or addresses on tickets, even if they appear with slight variations.
For this, special symbols are used to define flexible matching rules, such as requiring the text to start in a certain way, include several options, or accept any additional text.
Thanks to this, you can validate tickets more precisely and avoid rejecting those that do meet the promotion requirements.
1. Store Name Validation.
Allows the AI to correctly recognize store names.
Symbols you can use:
^→ Indicates that the match must start from the beginning of the name..*→ Allows any text after the term you are searching for.|→ Acts as “or,” so it matches one term or another.
Example:
Pattern: ^Carrefour.*
Will match: Carrefour, Carrefour Market, Carrefour Express, Carrefour Planet
If you want to validate several supermarkets at the same time, you can combine multiple terms using | and add .* to accept any text after the main name.
For example: ^Carrefour.*|^Lidl.*|^Mercadona.*
This will validate tickets from Carrefour, Lidl, or Mercadona, including their variants.
2. Address Validation.
Allows the AI to correctly recognize tickets from stores located in specific cities, areas, or addresses.
Symbol you can use:
|→ Acts as “or” and allows matching several options at once.
Example:
Pattern: Barcelona|Madrid|Valencia
Will match tickets from stores located in any of these cities: Barcelona, Madrid, or Valencia.
3. Product Validation.
Allows the AI to correctly recognize products, even if they appear with small variations on the ticket, such as typos or abbreviations.
Symbols you can use:
.?→ Allows zero or one additional character, useful for tolerating small variations or typos.|→ Acts as “or,” to match one or another product from the list.
Example:
Pattern: Café.?|Té Verde|Chocolate
Will match tickets that include: Café, Café con leche, Té Verde, or Chocolate.
If you have questions about how to set up these patterns or need help while creating your validation rules, you can contact us at help@cool-tabs.com and our team will assist you promptly.
Comments
0 comments
Please sign in to leave a comment.