Matching Rules

How to create your own Matching Rules

  1. Create an assignment strategy. The assignment strategy defines the rules for extracting important information from a payment description.
    1. Define an ident to attach the strategy to a merchant payment account later.
    2. Select a target type to define which kind of entity we try to match the payment with.
      1. Note: If you select Order and the Order has already been billed, we will still assign it to the invoice.
    3. Define the regex to parse the payment description and extract the assignment relevant data (most often the document ident).
    4. The Target Ident Pattern can be used to overwrite a found regex with a different value. It can for example be used to switch out special characters found in payment strings with the special characters used in your document idents.
    5. Enabling the slider "Disable Multiple Regex Matches" means that if a regex is used on a payment description and more than one match occurs, then the attempt on automatic assignment fails and a manual assignment has to be made.
  2. Configure which matching rules should be used for each merchant payment account.
    1. Define which merchant payment account you want to add matching rules to.
    2. Add the matching rules.
      1. Note: The order indicates in which orders we will attempt to find matches. If a match has been found the later regex rules won't be considered.

Regular Expressions Guide

Regular Expressions (Regex) are powerful tools used for matching patterns in text, which the Nitrobox utilizes
to provide exemplary customizability for your needs.
This guide provides an introduction to regex, with examples to help you create your own regex rules. For testing and refining your regex patterns, we recommend using Regex101.

Basics of Regex

A regex is a sequence of characters that defines a search pattern. Here are some basic components and concepts:

  • Literal Characters: Match the exact characters. For example, abc matches "abc".
  • Metacharacters: Special characters that have specific meanings:
    • .: Matches any single character except newline.
    • ^: Matches the start of a string.
    • $: Matches the end of a string.
    • *: Matches 0 or more occurrences of the preceding element.
    • +: Matches 1 or more occurrences of the preceding element.
    • ?: Matches 0 or 1 occurrence of the preceding element.
    • \: Escapes a metacharacter, treating it as a literal character.

Common Patterns

  1. Matching Digits: \d

    • Example: \d{3} matches any three digits (e.g., "123").
  2. Matching Words: \w

    • Example: \w+ matches one or more word characters (e.g., "hello").
  3. Whitespace: \s

    • Example: \s+ matches one or more whitespace characters (e.g., spaces, tabs).
  4. Character Sets: [abc]

    • Example: [aeiou] matches any one vowel.
  5. Ranges: [a-z]

    • Example: [0-9] matches any digit from 0 to 9.

Examples

Pattern: [a-zA-Z0-9_-]{8,20}

  • Description: Matches any combination of letters (uppercase and lowercase), digits, underscores, and hyphens.
  • Length: Between 8 and 20 characters.

Pattern: ^(ident-)([1-9]|[1-9][0-9]|100)$

  • Description: Validates an identifier with a specific range.
  • Details:
    • Starts with ident-
    • Followed by a number between 1 and 100, inclusive.
    • The number can be a single digit (1-9), a two-digit number (10-99), or exactly 100.

Testing Your Regex

We recommend using Regex101 to test your regex patterns. This tool provides feedback and detailed explanations of your regex components.

To use Regex101:

  1. Visit Regex101.
  2. Enter your regex pattern in the "Regular Expression" field.
  3. Input the text you want to test in the "Test String" field.
  4. View matches, explanations, and any errors in real-time.

By following this guide, you can become proficient in creating and using regex patterns for your configurations. Happy matching!