Regular Expression (Regex, RegExp)

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.

Recommended tutorials

https://danielfett.de/2006/03/20/regulaere-ausdruecke-tutorial/ (German)
https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285

Tools to test your pattern

http://regexstorm.net/tester
https://extendsclass.com/regex-tester.html
https://regex101.com/

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.

hubengine-regex

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.

Further articles