Skip to main content
Skip table of contents

REGEX_MATCH

The REGEX_MATCH function is used to match a regular expression pattern against a string content.

Usable: Value Fields, Context Filter

Syntax: { REGEX_MATCH((PARAM_1 PARAM_2)) }

Parameter

Type

Example

Description

PARAM_1

JSONPath value

$.issue.fields.customfield_X
$.value

The JSONPath expression representing the value that should be matched against the regular expression pattern.

PARAM_2

String

'^([^\s]*)'

The regular expression pattern to match against the value in PARAM_1

Value Field Example

Extract all text up to the first whitespace:

CODE
{ REGEX_MATCH(($.value '^([^\s]*)')) }

If $.value contains '12345 (branch/name)' the result will be 12345.

Context Filter Example

For example, consider the following data source JSON:

CODE
{
  "result": [
    {
      "id": 1,
      "group": "administrators",
      "name": "Mario Speedwagon",
      "username": "mario"
    },
    .... more items here ....
  ]
}

To filter results in which the id equals the custom field value of the issue until the first whitespace:

CODE
$.result[?(@.id=={ REGEX_MATCH(($.issue.fields.customfield_X '^([^\s]*)')) } )]

If the $.issue.fields.customfield__X field contains '1 (branch/name)' the resolved expression will be:

CODE
$.result[?(@.id==1)]

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.