When creating regular expressions for Mergado, you may find the regex101.com site useful to help you test the regex. Here are some tips I use:
1. Set up a Mergado-like environment.
- check Python in the left column under FLAVOR
- in the REGEX FLAGS section, you can modify the behavior of how the regular expression should be evaluated
Note: for convenient testing, I recommend setting up FLAGSg
andm
.
2. Try substitution
- if a regular expression matches some text, you can try replacing it with something else, similar to how the
Find and Replace
rule works in Mergado. So you can try this rule beforehand at regex101.com and then just transfer the data to Mergado. - Examples:
3. Send the link to the regex to a friend
- just use the keyboard shortcut Ctrl+S or click on the link to save:
- And then you can easily copy the address to your regex to the clipboard:
and you can send the link to someone right away.
4. Check your regular expression on a larger sample of data
-
It is a good idea to put as large a sample of data as possible in the
TEST STRING
field so that you can check the regular expression ideally in all cases that may occur. -
For example, if you are creating a variable from an element in Mergado, export all the input values to a CSV on the Elements page, and then copy the entire column of values from that CSV (or at least a few dozen values) into the
TEST STRING
field.
The procedure in more detail:-
export the input values of a specific element from Mergado to CSV:
-
open the CSV in some program, e.g. Calc/Excel/Numbers and copy the column with the values:
-
inserting it into regex101.com and detecting if the regular expression passes all values:
-
And how do you form regular expressions? Post your tips in the comments below that can help others easily create regular expressions and use them in Mergado.