Regex
You can use regular expressions (regex) to define mappings for each destination in a route. A common use case is mapping multiple signal names from an OPC UA or ADS namespace.
For example, suppose we want to map the ADS signals GVL.Weight1
and GVL.Consumption2
to Extruder-Weight-1
and Extruder-Consumption-2
, respectively. This can be achieved using a single regular expression with two capturing groups: one to match the signal name (Weight
or Consumption
) and another to match the trailing number.
The regular expression for this case is /GVL\.(.*)(\d)/
. Capturing groups can be referenced using the ${N}
syntax, where N
is the index of the group starting from 1.
In our example, the mapping value is defined as Extruder-${1}-${2}
, where:
${1}
captures the signal type (Weight
orConsumption
)${2}
captures the trailing number (1
or2
)
A helpful tool for testing and creating regular expressions is regexr.com.