How to case-sensitive searching in Mergado

When creating queries and rules, Mergado is not case sensitive, i.e. the search is case insensitive. If I search for an uppercase A, I will easily find a product with a lowercase a. :thinking:

Note: We have described how it is with element names and case sensitivity here: MERGADO 2 - Case-sensitivity
This post, however, is not about element names, but about searching element values within queries and rules.

If you need to search a case sensitively, i.e., there is a solution to this using regular expressions, or what are called REGEX FLAGS, which modify the behavior of how regular expressions are evaluated.

Case-sensitive queries

For creating queries, switch to MQL and use some query conditions within the value:
(?-i:…text or regular expression…)

The entire condition might then look like this, for example:

PRODUCTNAME ~ "(?-i: mug)".

→ which will find products that have the word mug in lowercase in their name.


Another example with a specific regular expression:

PRODUCTNAME ~ "(?-i:^[A-Z]{2})"

→ finds products that have the first two letters of PRODUCTNAME capitalized.

Case-sensitive rules

This works similarly in rules, e.g. for the “Find and Replace” rule type.

  • Check the checkbox that you want to search as a regular expression
  • In the find field, enter a regular expression wrapped in the syntax as above.

Example of how to remove text in CAPITAL LETTERS from a product name:
In the Find field, enter (?-i:[A-Z]{2,}) and leave the Replace field blank.

We can check the function of the rule for the monitored product:

:+1: :wink:

1 Like