Regex Replace Step
  • 28 Mar 2022
  • 1 Minute to read
  • Dark
    Light

Regex Replace Step

  • Dark
    Light

Overview

The Regex Replace step looks up text input via a regular expression pattern and then replaces the text that matches the pattern.


Example

  1. In a Designer Project, click CREATE FLOW to create a new Flow.
  2. Attach a Regex Replace step from the DATA > TEXT category in the Toolbox panel to the Start and End steps. On the Properties panel, Constant map the following text to the Input field: 
    $17.43 €2 16.33 £0.98 0.43 £43 €1217
    This String represents numeric values with different currency signs, leading and trailing the value.

  3. Set the mapping for the Options field to Ignore.
    There are options such as IgnoreCase, Multiline, ExplicitCapture, Compiled, Single-line, IgnorePatternWhiteSpace, RightToLeft, ECMAScript that can be used to Advanced the Search Pattern.
  4. Constant map the following to the Pattern field: 
    (\p{Sc}\s?)?(\d+L?)((?<=\.)\d+)?(?(1)|s?\p{Sc})?

  5. Enter "$2" in the Replacement field. 
    The Replacement value is used to remove either a leading or trailing currency symbol from a numeric value.

  6. Click Save to save changes to the Flow. 

Debug

  1. Click Debug from the top action bar. 
  2. Click START DEBUGGING. 
  3. Select the Regex Replace step, select Execution 1, and click View Output Data
    The step will output the input value with the currency symbols removed.



For further information on Flows, visit the Decisions Forum.

Was this article helpful?

What's Next