FEEL

replace

FEEL built-in function · FEEL string functions

replace(input, pattern, replacement, flags?)

Returns the input with every match of the regular expression replaced by the replacement, which may reference capture groups as $1, $2, ….

Parameters

ParameterTypeDescription
inputstringthe source string
patternstringregular expression to replace (XPath syntax)
replacementstringreplacement text; $1…$n reference capture groups
flagsstrings, m, i, x flags (optional)

Examples

replace("banana", "a", "o")
bonono Try it ↑
replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")
[1=ab][2=]cd Try it ↑

Edge cases and null handling

replace("a.b.c", ".", "-")

The pattern is a regex; an unescaped dot matches every character.

replace("a.b.c", "\\.", "-")
replace("abc", "b", "$")

A lone $ in the replacement is invalid and gives null.

replace("Hello", "l", "L", "i")

Related functions

matches · split

Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).