Available on plans:
Free
Pro
Team
Enterprise
If you need to separate part of a value in a field, you can do it by using Formatter's Extract Pattern transform. This allows you to use regular expressions (RegEx) to extract partial data from a field.
RegEx is an advanced feature. Zapier does not offer email support for RegEx. If you encounter a problem, we recommend asking questions on Zapier Community or StackOverflow and tagging them with "Zapier".
1. Add a Formatter step to your Zap
- Click the Action step, or click the plus + icon to add a step to your Zap.
- Select Format.
- Click the Event dropdown menu and select Text.
- Click Continue.
2. Set up the Extract pattern transform
- In the Transform dropdown menu, select Extract pattern.
- Select the field you want to search through in the Input field.
- Enter the Python regex you want to use in the Pattern field.
- Click Continue.
The Input field can work with line items. It will look for the pattern in each item individually. However, this Formatter step will not work with line items if Yes is selected in the Match All option.
Learn more about how to extract text from website URLs, email addresses, and phone numbers.
3. Optional: Set up option (flag)
To refine your pattern match, select yes from the following dropdown options:
- Match All - Matches all occurrences of pattern. Returns results as line items. Note: If this option is set to Yes, the Input field won't work with line items.
- IGNORECASE - Ignore upper/lowercase differences for matching.
- DOTALL - Allow dot (.) to match newline normally it matches anything but newline.
- MULTILINE - Within a string made of many lines, allow ^ and $ to match the start and end of each line.
4. Optional: Create a group label (Match All only)
If you select Yes in the Match All option, you should create a group label in your pattern. This creates named properties in a line item, making it identifiable for use in your Zap later.
In this example, we want to create a group label called all_foo_bars, by using the pattern (?P<all_foo_bars>f[o]+ bar)
.
5. Test your step
- Click Test step.
The step will show the results of the regular expression. If the regular expression finds a match, it will return it in the field output. As you can have multiple matches in your pattern, your output can vary. Each match will always return at least these fields:
0
- text of match_end
- last position of match in text_start
- first position of match in the text_matched
- true or false based on the match
If you have multiple matches in your pattern, the first match will appear as 0
, second match as 1
etc.
If you're using the Match All option, your results will be returned as line items.
Once you've set up this step, you can add another action where the result of the Formatter step will be used.