With regex you can extract a certain pattern from a character string (string) or change a character string. For example, you can filter out all words from a text that are between two certain characters or that begin with a certain character string. You can also use Regular Expression to exchange or move parts of the string according to a given pattern.
Tools to test your pattern
Substring by Regex
When you synchronise data between two systems, you may also be confronted with demanding requirements that you can realise quite easily using regular expressions. The extraction of a substring is such a case. Let’s assume that a text (string) is stored in one system and that you only want to synchronise a part of it (substring) into another system. Further, let’s assume that the substring is identified by inverted commas.
Here is the text:
Here my entire text where a substring is marked “with inverted commas”.
Der reguläre Ausdruck, über den der Substring ausgelesen werden kann:
Here the result:
with inverted commas
Regex in the HubEngine
In the HubEngine, the case described above can be set up via the mapping during synchronisation. Use the type “regex” for this. You can save your regular expression in the options field behind it.
In addition to the extraction of strings, strings can also be replaced in the mapping.
Important note: Use the debug mode of the HubEngine to test your settings. The values of the synchronised fields are temporarily recorded in the logs via the debug mode. You can then see the found substrings in the logs.