Skip to main content
Skip table of contents

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

$.issue.fields.customfield_X
$.value

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

PARAM_2

String

'origin'
' '

This represents the string to be replaced.

PARAM_3

String

'replace'
'|'

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

CODE
{ 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

CODE
$.result[?(@.value=~/({ REPLACE(( $.issue.fields.customfield_10XXX ' ' '|' )) })/g )]

If $.issue.fields.customfield__X contains 'This is a string' the expression will be:

CODE
$.result[?(@.value=~/(This|is|a|string)/g )]
JavaScript errors detected

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

If this problem persists, please contact our support.