Apache NiFi RecordPath Guide
Also available as:


Evaluates a Regular Expression against the contents of a String value and replaces any match with another value. This function requires 3 arguments: the String to run the regular expression against, the regular expression to run, and the replacement value. The replacement value may optionally use back-references, such as $1 and ${named_group}


Return value

replaceRegex( /name, 'o', 'x' )

Jxhn Dxe

replaceRegex( /name, 'o', 'xyz' )

Jxyzhn Dxyze

replaceRegex( /name, 'xyz', 'zyx' )

John Doe

replaceRegex( /name, '\s+.*', /workAddress/city )

John New York

replaceRegex(/name, '([JD])', '$1x')

Jxohn Dxoe

replaceRegex(/name, '(?<hello>[JD])', '${hello}x')

Jxohn Dxoe