Search And Replace Regex

Last Updated: 03/27/2018 Introduced in Version: 3.0

This tutorial demonstrates how to use Regex Replace Step in Decisions. The Regex Replace step is intended to look up text input by a regular expression pattern and replace text that matches the pattern.


We begin in the Designer Folder by clicking Create Flow on the Folder Actions Panel.

In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.

In the Flow Designer we add Regex Replace Step from the All Steps [Catalog] > Data > Text category.

Then, we connect Done outcome from the Replace Regex step to the End Step in our Flow. Next, we select Regex Replace step on the workspace to set it up. As an input we are going to use a Constant String that represents random numeric values with different currency signs (trailing and leading the value).

Next, we are going to Ignore options Input.

Note: there are options like IgnoreCase, Multiline, ExplicitCapture, Compiled, Singleline, IgnorePatternWhiteSpace, RightToLeft, ECMAScript to Advance our Regex Search Pattern.

Then, we are going to define our Constant Pattern as following…

Here is the explanation of this pattern:

\p{Sc} Match a currency symbol. {Sc} denotes any character that is a member of the Unicode Symbol, Currency category.

\s? Match zero or one white-space character.

(\p{Sc}\s?)? Match zero or one occurrence of the combination of a currency symbol followed by zero or one white-space character. This is the first capturing group.

(\d+ Match one or more decimal digits.

\.?) Match zero or one occurrence of a period (used as a decimal separator character).

((?<=\.)\d+)? If a period is the previous character, match one or more decimal digits. This pattern can be matched either zero or one time.

(\d+\.?((?<=\.)\d+)?) Match the pattern of one or more decimal digits followed by an optional period and additional decimal digits. This is the second capturing group. The call to the Replace method replaces the entire match with the value of this captured group.

(?(1)|\s?\p{Sc})? If the first captured group exists, match an empty string. Otherwise, match zero or one white-space character followed by a currency symbol.



Finally, we define our constant replacement Input that removes either a leading or a trailing currency symbol from a numeric value.


This completes our Flow. We can click Debug on the Top Panel of the Flow Designer.

Our Flow executes successfully in the Debugger. We can see our Input String to the Regex Replace step…

And, as an output from the Regex Replace Step we can see our String that represents numeric values without any undesired currency characters.

Additional Resources