- 4 minutes to read

Formula - replaceregex

Easily replace text using regular expressions in messages with the Nodinite replaceregex Formula plugin. This page shows how to substitute patterns 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 patterns from any [Payload][body] or [Context][] in any Log Event
  • βœ… Use any valid regular expression to match and replace patterns
  • βœ… 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 replaceregex Formula do?

The replaceregex('Pattern', 'NewValue', Content) Formula function substitutes all occurrences of a pattern (matched by regular expression) 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 ➜ replaceregex ➜ Result

graph LR A["Input: Text with pattern"] --> B["replaceregex('Pattern', 'NewValue', Content)"] B --> C["Result: Text with replaced values"]

Flow: The content is processed with a regular expression to replace all matched patterns with the new value.


Syntax

Replace pattern in message body: (See Example 1)

replaceregex('Pattern', 'NewValue', body)

Replace pattern in message context: (See Example 2)

replaceregex('Pattern', 'NewValue', context('MessageContextKey'))

Replace pattern in nested formula: (See Example 3)

replaceregex('Pattern', 'NewValue', jsonpath('$.path', body))

Common regex patterns:

replaceregex('[0-9]', 'X', body)                # Replace all digits with X
replaceregex('\\d+', 'REDACTED', body)          # Replace numbers with REDACTED
replaceregex('DELETE', 'UPDATE', body)          # Replace DELETE with UPDATE
replaceregex('[A-Z]{3}', 'XXX', body)           # Replace 3-letter uppercase codes

Example data

<TypedPolling xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/INT007">
  <TypedPollingResultSet0>
    <TypedPollingResultSet0>
      <ProjectNumber>1401518</ProjectNumber>
      <Company>400</Company>
      <Activity>1000</Activity>
      <Version>20250301060028</Version>
      <Action>DELETE</Action>
    </TypedPollingResultSet0>
    <TypedPollingResultSet0>
      <ProjectNumber>1401518</ProjectNumber>
      <Company>400</Company>
      <Activity>1001</Activity>
      <Version>20250301060028</Version>
      <Action>DELETE</Action>
    </TypedPollingResultSet0>
    <TypedPollingResultSet0>
      <ProjectNumber>4831351</ProjectNumber>
      <Company>355</Company>
      <Activity>1063</Activity>
      <Version>20250301060028</Version>
      <Action>DELETE</Action>
    </TypedPollingResultSet0>
    <TypedPollingResultSet0>
      <ProjectNumber>9233120</ProjectNumber>
      <Company>700</Company>
      <Activity>3400</Activity>
      <Version>20250301060028</Version>
      <Action>DELETE</Action>
    </TypedPollingResultSet0>
    <TypedPollingResultSet0>
      <ProjectNumber>9402000</ProjectNumber>
      <Company>734</Company>
      <Activity>5104</Activity>
      <Version>20250301060028</Version>
      <Action>DELETE</Action>
    </TypedPollingResultSet0>
  </TypedPollingResultSet0>
</TypedPolling>

replaceregex Formula function
Example of the replaceregex formula function in the Nodinite UI


Examples

Example 1: Replace all numbers with X

Input

Message body contains:

<ProjectNumber>1401518</ProjectNumber>

Formula Expression

replaceregex('[0-9]', 'X', body)

Result

<ProjectNumber>XXXXXXX</ProjectNumber>

replaceregex Formula function


Example 2: Replace DELETE actions with UPDATE

Input

Message body contains:

<Action>DELETE</Action>

Formula Expression

replaceregex('DELETE', 'UPDATE', body)

Result

<Action>UPDATE</Action>

Example 3: Replace company codes with placeholder

Input

Message body contains:

<Company>400</Company>

Formula Expression

replaceregex('<Company>[0-9]+</Company>', '<Company>XXX</Company>', body)

Result

<Company>XXX</Company>

Features

  • Replace patterns using any valid regular expression 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 replaceregex plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.


How to use the replaceregex Formula

  1. Select Formula as the expression type plugin.
  2. Enter your replaceregex expression in the 'Expression' text area.
  3. See Syntax section above for common patterns and usage examples.

Next Step

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