Block reference / Data

RegEx variable

Replace a text variable with what a regular expression matches, or with a replaced version.

In both appsWarpX BrowserWarpX Phone

RegEx variable runs a regular expression over a variable that holds text, and writes the result back into the same variable. Use Match value to pull a piece out, or Replace value to rewrite it, for example to reformat a date.

The RegEx variable block's settings, filled in as in the example below.

Settings

Variable name

The variable to work on. It must hold text, and it is overwritten with the result.

ExampleshipDate
Method

Match value keeps what the expression matches. Replace value replaces each match.

ExampleReplace value
Replace withwhen Method is Replace value

What each match becomes. $1, $2 and so on insert the expression's groups, and references such as {{variables.x}} are filled in. Leave it empty to delete the matches.

Example$3-$2-$1
RegEx

The expression, without the surrounding slashes.

Example(\d{2})/(\d{2})/(\d{4})
Flags

The button next to the expression. Tick global to act on every match, ignore case, or multiline.

Exampleg

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

Overwrites the variable with the result and hands the result on as {{prevBlockData}}.

Example: Turn a day/month/year date into year-month-day

  1. Start
  2. Open URL
  3. Get text
  4. RegEx variable
  5. Insert data
Where RegEx variable sits in the example workflow.
  1. Read the shipping date, such as 19/09/2026, into a variable named shipDate with Get text.
  2. Add RegEx variable and type shipDate in Variable name.
  3. Set Method to Replace value and Replace with to $3-$2-$1.
  4. Type (\d{2})/(\d{2})/(\d{4}) in RegEx and tick global under the flags button.
  5. Run it. shipDate is now 2026-09-19.

Good to know

  • Match value without global keeps the whole first match as text, not a group. With global it keeps a list of every match. With no match, the variable becomes empty (null).
  • The variable must hold text. A value that Insert data stored as a number, such as 129.90, stops the block with is not a string/text.
  • A missing variable stops the block with Cant find "shipDate" variable.
  • References are filled in only in Replace with, not in RegEx or the variable name.
  • For a variable whose name starts with $$, only this run's copy changes.

See also

  • Slice variable — Keep part of a variable's text or list, by position.
  • Get text — Read the text of one element or many, and save it to the table or a variable.
  • Insert data — Set variables and add values to the workflow's table, several at once.