Find Replace Task¶
Overview¶
The Find Replace Task performs multiple find-and-replace operations on text in a single step. Clean data, normalize formats, remove unwanted characters, convert between formats, or sanitize content by applying sequential text replacements.
When to use this task:
- Text normalization and standardization
- Data cleaning and formatting
- Remove or replace unwanted characters
- Convert between data formats
- Sanitize user input
- Template variable replacement
- Format conversion (dates, addresses, etc.)
- Character encoding fixes
Key Features:
- Multiple find/replace operations in sequence
- Regex special character escaping
- Global replacement (all occurrences)
- Case-sensitive matching
- Unlimited replacement pairs
- Variable support
- Sequential processing
Quick Start¶
1. Add Find Replace task
2. Enter source text
3. Add find/replace pairs
4. Replacements applied in order
5. Save
Configuration¶
Source Text¶
The text to perform replacements on.
Find/Replace Pairs¶
Find: " " (double space) → Replace: " " (single space)
Find: "\n" → Replace: "<br>"
Find: "$100" → Replace: "$99.99"
Find: "!" → Replace: "."
Add as many pairs as needed. Applied sequentially.
Output Fields¶
| Field | Description | Example |
|---|---|---|
task_34001_run | Success status | true |
task_34001_run_text | Result message | Successfully replaced text. |
task_34001_output | Text after replacements | Hi World. Price: $99.99 |
Real-World Examples¶
Example 1: Address Normalization¶
Scenario: Standardize address formats from various sources
Workflow: 1. Form Submission - Address entry 2. Find Replace - Normalize address 3. Edit Client - Update clean address 4. Webhook Out - Validate with postal service
Normalize Address:
Input: {{task_55001_address}}
Find/Replace Pairs:
1. Find: " " → Replace: " " (remove double spaces)
2. Find: "Street" → Replace: "St"
3. Find: "Avenue" → Replace: "Ave"
4. Find: "Road" → Replace: "Rd"
5. Find: "Boulevard" → Replace: "Blvd"
6. Find: "Apartment" → Replace: "Apt"
7. Find: "Suite" → Replace: "Ste"
8. Find: "Floor" → Replace: "Fl"
9. Find: "#" → Replace: "No."
10. Find: " " → Replace: " " (final cleanup)
Example:
Update Client:
Example 2: HTML Email Body Cleaning¶
Scenario: Convert plain text to HTML-safe format for email
Workflow: 1. AI Prompt - Generate email content 2. Find Replace - Convert to HTML 3. Email - Send formatted email
Convert to HTML:
Input: {{task_38001_email_body}}
Find/Replace Pairs:
1. Find: "&" → Replace: "&"
2. Find: "<" → Replace: "<"
3. Find: ">" → Replace: ">"
4. Find: "\n\n" → Replace: "</p><p>"
5. Find: "\n" → Replace: "<br>"
6. Find: " " → Replace: " "
Example:
Input:
Hello John,
Here's your quote:
Product A: $500
Product B: $750
Total: $1,250
Best regards
Output:
Hello John,</p><p>Here's your quote:<br>Product A: $500<br>Product B: $750</p><p>Total: $1,250</p><p>Best regards
Send Email:
Example 3: Phone Number Formatting¶
Scenario: Clean and format phone numbers to consistent style
Workflow: 1. Form Submission - Contact form 2. Find Replace - Remove formatting 3. Phone Formatter - Format to E.164 4. New Client - Create with clean phone
Remove All Formatting:
Input: {{task_55001_phone}}
Find/Replace Pairs:
1. Find: "(" → Replace: ""
2. Find: ")" → Replace: ""
3. Find: "-" → Replace: ""
4. Find: " " → Replace: ""
5. Find: "." → Replace: ""
6. Find: "+" → Replace: ""
7. Find: "ext" → Replace: ""
8. Find: "x" → Replace: ""
Example:
Then Format:
Example 4: SQL Query Sanitization¶
Scenario: Clean user input before using in SQL queries
Workflow: 1. Webhook In - API search request 2. Find Replace - Sanitize search term 3. MySQL Query - Safe database search 4. Webhook Out - Return results
Sanitize Input:
Input: {{task_46001_search_term}}
Find/Replace Pairs:
1. Find: "'" → Replace: "''"
2. Find: "\"" → Replace: ""
3. Find: ";" → Replace: ""
4. Find: "--" → Replace: ""
5. Find: "/*" → Replace: ""
6. Find: "*/" → Replace: ""
7. Find: "DROP" → Replace: ""
8. Find: "DELETE" → Replace: ""
9. Find: "INSERT" → Replace: ""
10. Find: "UPDATE" → Replace: ""
Safe Query:
SELECT product_id, name, description, price
FROM products
WHERE name LIKE '%{{task_34001_output}}%'
OR description LIKE '%{{task_34001_output}}%'
LIMIT 50
Warning: This is basic sanitization. Always use parameterized queries or proper SQL escaping in production.
Example 5: CSV Data Cleaning¶
Scenario: Clean CSV data before import
Workflow: 1. Webhook In - CSV data received 2. Find Replace - Clean data 3. Loop - Process each row 4. New Client - Import cleaned records
Clean CSV Data:
Input: {{task_46001_csv_row}}
Find/Replace Pairs:
1. Find: "\r\n" → Replace: "" (remove Windows line endings)
2. Find: "\n" → Replace: "" (remove Unix line endings)
3. Find: "\"\"" → Replace: "\"" (fix escaped quotes)
4. Find: "N/A" → Replace: ""
5. Find: "NULL" → Replace: ""
6. Find: "null" → Replace: ""
7. Find: " " → Replace: " " (remove double spaces)
8. Find: " ," → Replace: "," (fix spacing before commas)
9. Find: ", " → Replace: "," (normalize comma spacing)
Example:
Import Clean Data:
Company: {{task_34001_output_col_1}}
Email: {{task_34001_output_col_2}}
Phone: {{task_34001_output_col_3}}
Address: {{task_34001_output_col_4}}
Best Practices¶
Order Matters¶
Replacements apply sequentially. Earlier changes affect later ones.
Example:
Input: "test TEST Test"
Option 1 (convert then remove):
1. Find: "test" → Replace: "TEST" # Result: "TEST TEST Test"
2. Find: "TEST" → Replace: "" # Result: " Test"
3. Find: "Test" → Replace: "" # Result: " "
Option 2 (remove then convert):
1. Find: "test" → Replace: "" # Result: " TEST Test"
2. Find: "TEST" → Replace: "" # Result: " Test"
3. Find: "Test" → Replace: "" # Result: " "
Plan order carefully!
Common Patterns¶
Remove extra whitespace:
1. Find: "\t" → Replace: " " (tabs to spaces)
2. Find: " " → Replace: " " (double to single)
3. Find: " " → Replace: " " (repeat to catch multiple)
URL encoding:
1. Find: " " → Replace: "%20"
2. Find: "!" → Replace: "%21"
3. Find: "#" → Replace: "%23"
4. Find: "$" → Replace: "%24"
Strip HTML tags:
1. Find: "<br>" → Replace: "\n"
2. Find: "<p>" → Replace: ""
3. Find: "</p>" → Replace: "\n\n"
4. Find: "<strong>" → Replace: ""
5. Find: "</strong>" → Replace: ""
Edge Cases¶
- Empty find string - Avoid, causes issues
- Circular replacements - Don't replace A→B then B→A
- Regex special characters - Automatically escaped
- Case sensitivity - Always case-sensitive
Troubleshooting¶
Replacement Not Working¶
Issue: Text not being replaced
Causes: - Find string doesn't match exactly (case, spacing) - Previous replacement modified text - Special characters not escaped properly
Solution:
# Check exact match
Code Task: return {debug: input.task_X001_field};
# Try with Formatter first
Formatter: UPPERCASE or LOWERCASE
Wrong Final Output¶
Issue: Unexpected result after replacements
Cause: Order of operations
Solution: - Review replacement order - Test incremental replacements - Use multiple Find Replace tasks if needed
Partial Replacements¶
Issue: Only some occurrences replaced
Cause: Previous replacement altered text
Example:
Input: "cat dog cat cat"
1. Find: "cat" → Replace: "dog" # "dog dog dog dog"
2. Find: "dog" → Replace: "pet" # "pet pet pet pet"
All "cat" became "pet" because they were first converted to "dog"
Solution: Be mindful of replacement chains
Special Characters Issues¶
Issue: Regex characters causing problems
Solution: Task automatically escapes these:
No manual escaping needed.
Frequently Asked Questions¶
Is matching case-sensitive?¶
Yes, always case-sensitive. Use Formatter task to normalize case before Find Replace if needed.
Can I use regex patterns?¶
No, only literal string matching. For regex, use Pattern Regex task.
How many replacements can I add?¶
No hard limit. Keep practical (10-20 pairs typical).
Does it support multi-line text?¶
Yes, works with newlines (\n) and any text format.
Can I replace with empty string?¶
Yes, effectively removes the found text.
What if find string appears in replace string?¶
Second occurrence won't be replaced again (not recursive). Only original text is searched.
Can I use variables in find/replace strings?¶
Yes, both support variable replacement from previous tasks.
Related Tasks¶
- Formatter - Case conversion, trim, padding
- Pattern Regex - Pattern-based extraction/validation
- Variable - Store cleaned text for reuse
- Code Task - Complex text transformations
- Loop - Apply cleaning to multiple items