Ido Toolbox icon

Ido Toolbox

A comprehensive collection of useful tools for data processing, text manipulation, and daily operations

Tool → Multiple Search and Replace

AI-generated

Overview

The "Multiple Search and Replace" operation in the Ido Toolbox node allows users to perform multiple text replacements on a given input string in one execution. It is useful for scenarios where you need to clean, modify, or standardize text by replacing several substrings simultaneously. For example, it can be used to correct common typos, update product codes, or sanitize user input by replacing sensitive words.

Practical examples:

  • Replacing multiple misspelled words with their correct spellings.
  • Updating old URLs or email domains within a block of text.
  • Standardizing terminology across documents by replacing synonyms or abbreviations.

Properties

Name Meaning
Input Text The original text on which the search and replace operations will be performed.
Replacements A list of replacement pairs, each containing:
- Search For: The substring to find in the input text.
- Replace With: The substring to replace the found text with.
Case Sensitive Boolean flag indicating whether the search should consider letter case (true) or ignore it (false).

Output

The output JSON object contains the following fields:

  • inputText: The original input text provided.
  • outputText: The resulting text after all replacements have been applied.
  • changesMade: Boolean indicating if any replacements were made.
  • replacementsApplied: An array of objects detailing each replacement performed, with:
    • search: The search string used.
    • replace: The replacement string applied.
    • replacementsMade: Number of times this particular replacement was applied.
  • totalReplacements: Total count of all replacements made across all search-replace pairs.

This structure provides both the transformed text and detailed information about what changes occurred during processing.

Dependencies

  • No external services or API keys are required.
  • This operation runs entirely within the node using built-in JavaScript functionality.
  • No special environment variables or n8n configurations are needed.

Troubleshooting

  • No replacements applied:
    Ensure that the "Search For" strings exactly match parts of the input text. If "Case Sensitive" is enabled, verify the casing matches as well.

  • Invalid input errors:
    The node expects a non-empty string for "Input Text" and at least one valid replacement pair. Empty or missing values may cause no changes or errors.

  • Unexpected behavior with special characters:
    The search strings are escaped before creating regular expressions, so special regex characters in the search terms are treated literally. However, very complex patterns or overlapping replacements might produce unexpected results.

  • Performance considerations:
    Very large input texts with many replacements could impact performance. Consider splitting input into smaller chunks if necessary.

Links and References

Discussion