- 3 minutes to read

Formula - replaceregex

The replaceregex formula in Nodinite lets you replace any string or pattern in message body, context, or even nested formulas using regular expressions. This page provides a clear, step-by-step guide with practical examples, so you can quickly master regex-based text replacement for your integration needs.

✅ Replace any value in message body or context using regex
✅ Use with nested formulas for advanced scenarios
✅ Enhance data quality and search field results in Nodinite


What is the replaceregex formula?

The replaceregex function substitutes all occurrences of a specified pattern (using regular expressions) with a new value. You can use it on message body, context, or the result of another formula.


How does it work?

Each example below is structured in three clear steps:

  1. Input – The data or context you start with
  2. Formula – The replaceregex expression you use
  3. Result – The output you get

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:

<ProjectNumber>1401518</ProjectNumber>

Formula:

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

Result:

<ProjectNumber>XXXXXXX</ProjectNumber>

Replaces all digits in the ProjectNumber with 'X'


Example 2: Replace DELETE actions with UPDATE

Input:

<Action>DELETE</Action>

Formula:

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

Result:

<Action>UPDATE</Action>

Replaces all 'DELETE' actions with 'UPDATE'


Example 3: Replace company codes with a placeholder

Input:

<Company>400</Company>

Formula:

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

Result:

<Company>XXX</Company>

Replaces all company codes with 'XXX'


Usage Tips

  • Use with any Content that returns text
  • Works with jsonpath, xpath, or other formula functions
  • Only use on small messages—this function loads the entire message into RAM

Next Step

Add or manage Search Fields
Add or manage Log Views