The RETransform (regular expression) transformation is a pattern-matching transformation that uses regular expressions to specify a pattern to look for and capture in the input and stores the captured string in a designated output field.
Regular expressions are evaluated against the entire input string. If the input does not match the pattern specified in the regular expression, no data is captured. For a brief guide to using regular expressions, see Regular Expressions .
The RETransform transformation operates similarly to the REMatch transformation (see REMatch ), which constructs an output field for each capturing sub-pattern in the regular expression. You can think of RETransform as a combination of REMatch and Format transformations. If the Action parameter (see Action in the following table) is set to "RESULTS," then RETransform operates like a combination of REMatch and Union transformations.
|Name||Descriptive name of the transformation. You can enter any name here.|
|Comments||Optional. Notes about the transformation.|
|Condition||The conditions under which this transformation is applied.|
|Default||The default value to use if the condition is met and the input value is either not available or the regular expression does not match the input value.|
Specifies how the result is treated. The default setting of RESULTS simply takes the patterns matched and creates a vector of strings from the patterns being extracted.
Alternatively, the action may be a formatting string to create a simple string output of a particular format. With this technique, you specify the number corresponding to the location of each matched pattern between % signs. For example, the 1st matched pattern would be %1%, and the 3rd matched pattern would be %3%. You would specify other characters in the formatting string literally.
|Expression||The regular expression used for matching.|
|Input||The field against which the regular expression is evaluated.|
|Output||The name of the output string.|
RETransform transformations can be very slow and may account for much of the data processing time.
This example isolates the version of the Windows operating system that a website visitor is using and creates a field x-windows-version from that value. The output value in this case would simply be the version number.
If you wanted to include the string "Version" in front of the version number for readability, you would change the Action parameter from "RESULTS" to "Version %1%." To include a literal percent sign (%) in your output, escape it with a second percent sign, as in "%%."