Search and Replace text
Text Operations
Action
Given a text, it allows you to perform one or more search and replacement operations.
- Accepts regular expressions.
Regular Expression Examples
The following table contains a list with examples of regular expressions for different cases.
Case sensitive match with case sensitive replacement
Pattern | text |
Replacement | TXT |
Example | text 1. Text 2. TEXT 3 |
Result | TXT 1. Text 2. TEXT 3 |
Case insensitive match with case sensitive replacement
Pattern | /text/i |
Replacement | TXT |
Example | text 1. Text 2. TEXT 3 |
Result | TXT 1. TXT 2. TXT 3 |
Replaces the 'tag' value of a URL
Pattern | /(&|\?)tag=[^&\s]*/ |
Replacement | $1tag=NEW-21 |
Example | https://amazon.com?tag=OLD-21&psc=1 |
Result | https://amazon.com?tag=NEW-21&psc=1 |
Remove any link to the ABC or CDE domain
Pattern | /(https?:\/\/)?(www\.)?(abc|cde)\.(.[^\s]*)/i |
Replacement | |
Example | https://abc.com http://www.cde.com https://fgh.com |
Result | https://fgh.com |
Convert Amazon URLs to Affiliate Links
Pattern | /(amazon.es|amazon.com)\/(gp\/product|[^\/]*\/dp|dp)\/([^\/\?]*)(\/[^\s]*|\?[^\s]*)?/ |
Replacement | $1/$2/$3/?tag=mytag-21 |
Example | https://amazon.com/tshirt/dp/B09V5B7W7P/ref=sr_1 |
Result | https://amazon.com/tshirt/dp/B09V5B7W7P/?tag=mytag-21 |
Replace multiple spaces with a single space
Pattern | /\s+/ |
Replacement | (Indicate a space here) |
Example | red green blue |
Result | red green blue |
Information provided
When executed, this operation delivers the following data, which can be used in the same automatic task.
Tags
- Matches found {{matches_found}}
Related automations
Extracts each new message from a public/private Telegram chat, searches and replaces certain words, and then publishes it in a separate Telegram chat
Retrieve every new message from your Telegram chat, search for and replace specific words, and then update the original message
Let's talk
Choose day and time.
We share the screen and answer all your questions.