- 0 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.


Syntax

Replace in message body: (See Example 1)

replace('OldValue', 'NewValue', body)

Replace in message context: (See Example 2)

replace('OldValue', 'NewValue', context('MessageContextKey'))

Replace in nested formula: (See Example 3)

replace('OldValue', 'NewValue', jsonpath('$.path', body))

Common patterns:

replace(' ', '_', body)                      # Replace spaces with underscores
replace('\n', '', body)                      # Remove line breaks
replace('test', 'production', body)          # Environment name swap

Examples

Example 1: Replace a word in the message body

Input

Message body is nodinite

Formula Expression

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

Result

most innovative product

Example 1


Example 2: Replace a word in a context value

Message context contains a property id with value nodinite

Formula Expression

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

Result

most innovative company

Example 2


Example 3: Replace a word in a nested formula result

Input

Message body is:

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

Formula Expression

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

Result

Cool Function, Cool Implementation

Example 3


Features

Important

The replace Formula substitutes all occurrences of a specified string with a new value. This function loads the entire message into RAM—use on small messages only.

  • Flexible Inputs: Replace in message body, Context, or the result of another Formula
  • Global Replacement: Substitutes all occurrences of the old value
  • Composable: Combine with other Formula functions for powerful transformations
  • Self-Service: Let business users transform data without developer intervention

How to use

To use the replace Formula in a Search Field Expression:

  1. Open your Nodinite Web Client
  2. Navigate to AdministrationSearch Fields
  3. Create or edit a Search Field
  4. Choose Formula as the expression type
  5. Enter your replacement expression using the Syntax patterns above

Next step