Extract data using regular expressions
Text Operations
Action
Generates new tags with the data extracted from one or more regular expressions.
Each new tag is a list of 1 or more items according to the regular expression used. To access the values ​​of each tag, use the name followed by a period and the index of the element. For example {{new_tag.1}} to access the second value containing the tag.
This operation is equivalent to the command match in Javascript.
Regular Expression Examples
The following table contains a list of regular expression examples for different cases.
Extract first sentence
Text | Text 1. Text 2. Text 3. |
Pattern | /(.[^\.]*)\./ |
Results | {{match.0}} → Text 1. {{match.1}} → Text 1 |
Extract the first sentence and the remaining text
Text | Text 1. Text 2. Text 3. |
Pattern | /(.[^\.]*)\.(.*)/ |
Results | {{match.0}} → Text 1. Text 2. Text 3. {{match.1}} → Text 1 {{match.2}} → Text 2. Text 3. |
Extract the email
Text | My email address is contact@gmail.com |
Pattern | /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi |
Results | {{match.0}} → contact@gmail.com |
Extract the first number
Text | The ABC 123 Song |
Pattern | /^[^\d]*(\d+)/ |
Results | {{match.0}} → The ABC 123 {{match.1}} → 123 |
Extract the first URL
Text | Visit my website https://abc.com/section?param=1 |
Pattern | /(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])/ |
Results | {{match.0}} → https://abc.com/section?param=1 {{match.1}} → https {{match.2}} → abc.com {{match.3}} → /section?param=1 |
Extract the first URL from a specified domain
Text | Visit my website https://abc.com/section?param=1 and https://xyz.com |
Pattern | /https://ad\.admitad\.com/[^"\s]+/ |
Results | {{match.0}} → https://xyz.com |
Let's talk
Choose day and time.
We share the screen and answer all your questions.