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 |
| The JSONPath expression representing the value that should be matched against the regular expression pattern. |
PARAM_2 | String |
| The regular expression pattern to match against the value in PARAM_1 |
Value Field Example
Extract all text up to the first whitespace:
{ 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:
{
"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:
$.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:
$.result[?(@.id==1)]