- 3 minutes to read

Formula - replace

Easily replace text in messages using the Nodinite replace Formula plugin. This page shows how to substitute strings in message Content, Context, or the output of other formulas.

🎯 Designed for business users and integrators β€” no developer required; you can even use AI to craft expressions.

  • βœ… Replace text from any Payload or Context in any Log Event
  • βœ… Substitute all occurrences of a string with a new value
  • βœ… Transform and surface meaningful data in Nodinite Log Views, search filters, and self-service diagnostics
  • βœ… Combine with other Formula functions for powerful, layered expressions

What does the replace Formula do?

The replace('OldValue', 'NewValue', Content) Formula function substitutes all occurrences of a specified string with a new value. Use it on message bodies, context values, or the results from other Formula functions to transform data in your views.


How it works: Input ➜ replace ➜ Result

graph LR A["Input: Text with old value"] --> B["replace('OldValue', 'NewValue', Content)"] B --> C["Result: Text with new value"]

Flow: The content is processed to replace all occurrences of the old value with the new value.


Example 1 β€” Replace a word in the message body

Input from body

nodinite

Formula Expression

replace('nodinite','most innovative product',body)

Result

most innovative product

Example 1
Example: Replacing 'nodinite' with 'most innovative product' in the message body.


Example 2 β€” Replace a word in a context value

Suppose you have a message context value with the key id containing nodinite.

Input

nodinite

Formula Expression

replace('nodinite','most innovative company',context('id'))

Result

most innovative company

Example 2
Example: Replacing 'nodinite' with 'most innovative company' in the context value.


Example 3 β€” Replace a word in a nested formula result

Suppose you have a JSON array with multiple names that need replacement.

Input

[  { "name": "Amazing Function" }, { "name": "Amazing Implementation" } ]

Formula Expression

replace('Amazing','Cool',jsonpath('$..name',body))

Result

Cool Function, Cool Implementation

Example 3
Example: Replacing 'Amazing' with 'Cool' in all names returned by the jsonpath function.


Features

  • Replace all occurrences of a string with another value in any Content
  • Works with message body, context, or results from other Formula functions
  • Combine with other Formula functions for powerful, layered expressions
  • Use in Log Views for filtering, grouping, and self-service diagnostics

Important

The replace plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.


How to use the replace Formula

  1. Select Formula as the expression type plugin.
  2. Enter your replace expression in the 'Expression' text area.
  3. Provide the old value, new value, and Content parameter (for example, the message body, a context value, or another formula result).

Syntax

  • Replace in message body:
    replace('OldValue', 'NewValue', body)
  • Replace in message context:
    replace('OldValue', 'NewValue', context('MessageContextKey'))
  • Replace in another formula:
    replace('OldValue', 'NewValue', SomeOtherNestedFormulaFunction(Content))

Next Step

How to Add or manage Search Fields
How to Add or manage Log Views