Skip to content

databytoufik/n8n-nodes-text-replace

Repository files navigation

n8n-nodes-text-replace

A powerful n8n community node for text find and replace operations with support for simple replacements, multiple replacement pairs, and regular expressions.

n8n Text Replace Node - Simple Replace operation showing Hello replaced with Hi Simple Replace: "Hello" → "Hi" transforms the input text

Demo

Watch the demo

Watch the full demo on YouTube

Features

  • Simple Replace: Find and replace a single string
  • Multiple Replace: Apply multiple find/replace pairs in sequence
  • Regex Replace: Use regular expressions for advanced pattern matching
  • Flexible Input Sources: Work with specific fields, all string fields, or custom text
  • Options: Case sensitivity control, replace all or first occurrence only

Installation

In n8n Desktop or Self-hosted

  1. Go to Settings > Community Nodes
  2. Select Install
  3. Enter n8n-nodes-text-replace and click Install

Using npm

npm install n8n-nodes-text-replace

Operations

Simple Replace

Find and replace a single string in your text.

Simple Replace operation in n8n Text Replace node Replacing "Hello" with "Hi" in the input text

Parameters:

  • Field Name: The field containing text to process
  • Find: The string to search for
  • Replace With: The replacement string

Example:

  • Input: Hello World! Hello everyone!
  • Find: Hello
  • Replace With: Hi
  • Output: Hi World! Hi everyone!

Multiple Replace

Apply multiple find/replace pairs in sequence. Each replacement is applied to the result of the previous one.

Multiple Replace operation with sequential find and replace pairs in n8n Applying multiple replacements: "Hello" → "Hi" and "World" → "Universe"

Parameters:

  • Field Name: The field containing text to process
  • Replacement Pairs: A list of find/replace pairs to apply in order

Example:

  • Input: Hello World! Hello everyone!
  • Pairs: Hello -> Hi, World -> Universe
  • Output: Hi Universe! Hi everyone!

Regex Replace

Use regular expressions for advanced pattern matching and replacement.

Regex Replace with capture groups in n8n Text Replace node Using capture groups to swap words: "Hello World!" → "World Hello!"

Parameters:

  • Field Name: The field containing text to process
  • Regex Pattern: The regular expression pattern to match
  • Replace With: The replacement string (supports capture groups like $1, $2)
  • Regex Flags: Optional flags (g = global, i = case-insensitive, m = multiline)

Example:

  • Input: Hello World!
  • Pattern: (\w+) (\w+)!
  • Replace With: $2 $1!
  • Output: World Hello!

Input Sources

The node supports three input sources:

Source Description
Specific Field Process a single named field from the input
All String Fields Process all string fields in the input item
Custom Text Process custom text (can use expressions)

Options

Case Sensitive

Controls whether matching is case-sensitive (enabled by default). The screenshot below shows Case Sensitive OFF, allowing hello to match Hello:

Case insensitive text replacement in n8n workflow Case Sensitive OFF: "hello" matches "Hello" in the input

Replace All Occurrences

Controls whether all matches are replaced (enabled by default). The screenshot below shows Replace All OFF, replacing only the first occurrence:

Replace first occurrence only option in n8n Text Replace Replace All OFF: Only the first "Hello" is replaced

Include Nested Fields

When processing all string fields, this option includes fields in nested objects and arrays.

Output to New Field

Instead of modifying the original field, output the result to a new field with a custom name.

Example Workflow

An example workflow is included in the package. Import example-workflow.json to see the node in action with all three operations demonstrated.

Use Cases

  • Data Cleaning: Standardize text formats, remove unwanted characters
  • Template Processing: Replace placeholders with actual values
  • Content Transformation: Convert formats, update terminology
  • Batch Text Processing: Apply consistent changes across multiple items
  • Log Processing: Extract or transform patterns in log data

Compatibility

  • Requires n8n version 1.0.0 or later
  • Node.js 18.0.0 or later

License

MIT

Author

Created by Toufik

Support

If you find this node helpful, consider supporting its development:

Ko-fi

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.

Changelog

0.1.0

  • Initial release
  • Simple Replace operation
  • Multiple Replace operation
  • Regex Replace operation
  • Support for multiple input sources
  • Configurable options (case sensitivity, replace all, nested fields)

Releases

No releases published

Packages

 
 
 

Contributors