Document toolboxDocument toolbox

Regex

Description

This unit is a Processor unit type.

The Regex unit matches some text against a given RegExp, optionally providing captured groups as output event fields. RegExp uses Java syntax.

An event comes in through the in port. The regular expression set in the properties is executed and the match is performed.
Successful input events are enriched with new fields containing captured groups, and the event is output through the match port.
If an error occurs, the input event is enriched with new fields describing the problem, and the event is sent through the fail port.

Configuration

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Description

Enter a description detailing the scope of the unit.

Regular expression

Enter a Java regexp to determine the behavior of the unit.

Match field name

The name of the input event field containing text to be matched.

Unnamed field prefix

A prefix for output event fields containing unnamed capture groups. Leave empty if you do not wish to apply.

Find

Whether regexp is to match full text (false), or only part of it (true).

Input ports

Port

Description

Port

Description

in

Events containing a field with text to be matched.

Output ports

Port

Description

Port

Description

match

Outputs events enriched with a field containing the captured groups.

For named groups, a field with that name is added. For unnamed groups, and if the unnamed Field Prefix setting is set, fields starting with that prefix and growing numeric suffixes (starting at 1) are added.

fail

Signals when an error occurs and outputs input events, unmodified.

Example

In this example, we want to send a data string to be match against a given regular expression so that it can be inserted into a my.app table in Devo.

First, we will use a Tick unit to send the fields when clicked.

In the Fields tab of the properties, add the following:

Then, we will link it to a Regex unit to match the text against a regular expression, specified in the properties:

Finally, we will link its match output port to a Devo sink unit to send the formatted events to a my.app table.

Download this example

You can try this flow by downloading this JSON and uploading it to your domain using the Import option: