Knowledge Base

How to use regular expressions in XTM Cloud

Regular expressions can be used to perform an in-depth quality assurance check. XTM Cloud provides a series of predefined regexes in the QA profile, and you can also add your own custom regex. QA profiles can be global or customer-specific. You can assign just one QA profile to a project, but within that one profile, it is also possible to add multiple QA checks.

Using a predefined regex:

Go to the configuration gear icon > Settings > Add QA profile > Enter [QA profile name] > scroll down to the Regular expressions section > Select the relevant predefined regex (you can select multiple choices):

  • Punctuation mismatch
  • camelCase mismatch
  • PascalCase mismatch
  • UPPERCASE mismatch
Save the QA profile and add it whilst creating a new project or select it in the project General info section.
Using custom regex:
When using a custom regex, it is possible to select one of three matching types. In the following example, the same regex validating an email is used. Choose one of the matching types (broad match/ phrase match/ exact match) depending on the mismatches you want to identify. Warnings are displayed in the XTM Workbench QA panel.

1. Select the configuration gear icon > Settings > Add QA profile.
QA settings in XTM Cloud
2. In the QA profile popup, add the name for your QA profile.
Add QA checks in XTM Cloud
3. Scroll down to the Regular expressions section: Add a unique QA check name, then enter your regex and choose the matching type from the dropdown and save. The QA profile can contain several QA checks. To illustrate how the matching types work, take a look at the three QA checks for the same regex but with different matching types.
Add regex in XTM Cloud

Broad match: Broad match throws a QA warning for a different number of matches found in source and in target. The regex checks if we have a valid email address. In this case, the email address is missing @: it is not a valid address so it doesn’t match the regex – we get a warning.
QA broad match in XTM Cloud
Phrase match: If an email address in the target varies from the source, a warning appears. In the example, support@xtm-intl.com in the source has been replaced with support@xtm.cloud – phrase match generates a warning which would have been omitted by the broad matching type.
QA phrase match XTM Cloud
Exact match: A list of email addresses has to appear in the same order both in source and target. Only the exact matching check generates a warning for this type of error.
QA regex phrase match in XTM Cloud
4. Once the relevant matching type has been chosen, save the QA profile and add it to your project. You can add it during project creation, or select it in the project General info section.
Add a QA profile to your project in XTM Workbench