RegexCapture

The RegexCapture action captures part of a string with a regular expression (regex).

The following table shows the parameters for the RegexCapture action.

Table 1. RegexCapture action parameters
Name Data type Required Notes
pattern RegEx Yes

The regular expression pattern.

The pattern must contain only one capture group.

The regex pattern must be a Java-type regex. For more information, see Class Pattern (https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).

value String Yes The value to capture from.
savePath JPath Yes The location to store the result.

XML Example:

This action runs the regex that is defined in the pattern to the string stored in the State as /data. The capture group value is stored in the State at location /id. The provided regex captures one or more digits that follow "id=".

<RegexCapture pattern="id=([0-9]+)" value="${/data}" savePath="/id" />