Replace strings with regular expressions

The Row by Row Comparison Module allows you to specify cell settings which apply certain actions to columns and cells. For example, you can replace strings with regular expressions.

How to use the ReplaceRegex setting

Take a look at the following examples to learn more about replacing strings with regular expressions and how this can be useful in your comparisons.

Replace symbols

In these examples, you use the ReplaceRegex command to replace symbols.

Cell value

Command

Result

Description

$212

ReplaceRegex[(\$)][]

212

Removes the dollar symbol ($).

3.1

ReplaceRegex[(\.)][,]

3,1

Replaces period (.) with a comma (,).

Replace special characters or unicode symbols

In these examples, you use the ReplaceRegex command to replace special characters and unicode symbols.

Cell value

Command

Result

Description

a\u00A0b

ReplaceRegex[(\u00A0)][ ]

a b

Replaces non breaking space (\u00A0) with a regular space.

a\0b

ReplaceRegex[(\u0000)][_]

a_b

Replaces the null character (\0) with underscore (_).

Use capture groups

In these examples, you use the ReplaceRegex command with capture groups. This means that multiple characters are treated as a single unit.

Cell value

Command

Result

Description

Data Integrity

ReplaceRegex[([\s\w]+)][Hello $1]

Hello Data Integrity

Captures the text Data Integrity and uses $1 for the capture group value in the result. For more capture groups, use $2, $3, and so forth.

Data Integrity

ReplaceRegex[(Data)"{1}"][Hello $1]

Hello Data Integrity

Specifies that capture group Data appears only once. You must escape curly braces {} with double quotes "".