REPLACE
The REPLACE function is used to replace all occurrences of a specified string with another string in a given JSONPath value.
Usable: Value Fields, Context Filter
Syntax: { REPLACE((PARAM_1 PARAM_2 PARAM_3)) }
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 |
| This represents the string to be replaced. |
PARAM_3 | String |
| This represents the string to replace the matches specified in PARAM_2. |
Value Field Example
Use the REPLACE function to replace all spaces in the JSONPath value with the pipe symbol
{ REPLACE(($.value ' ' '|')) }
If $.value
contains 'This is a string'
the result will be This|is|a|string
.
Context Filter Example
Use the REPLACE function to replace all spaces in the JSONPath value with the pipe symbol
$.result[?(@.value=~/({ REPLACE(( $.issue.fields.customfield_10XXX ' ' '|' )) })/g )]
If $.issue.fields.customfield__X
contains 'This is a string'
the expression will be:
$.result[?(@.value=~/(This|is|a|string)/g )]