This can be useful with IfMatchActions, if you want to for instance see if two measure have the same string value, but can't be sure that the value doesn't contain regular expression reserved characters.
Code: Select all
[MeasureOne]
Measure=String
String=[Some+Text]
[MeasureTwo]
Measure=String
String=[Some+Text]
IfMatch=[MeasureOne:EscapeRegExp]
IfMatchAction=[!Log "They are the same"]
IfNotMatchAction=[!Log "They are different"]
DynamicVariables=1
What this will actually do under the covers is:
IfMatch=\[Some\+Text]
In the example above, the "[" and "]" in the regular expression would create a "character class", and the "+" would be seen as a directive of "1 or more instances" instead of being used as literals, and would produce undesirable results.