Extract Specific Text from Email Content in Zapier Workflow

I have a workflow that processes voicemail notifications from Google Voice. After removing HTML tags from the email, I get this text format:

.links-date a {color:#000000; text-decoration:none} .links-footer a {color:#757575; line-height:12px; text-decoration:none} .im {color:#000!important} --> Hello, this is a test message play message ACCOUNT SETTINGS SUPPORT CENTER COMMUNITY To modify voicemail email settings, visit Email preferences in your settings. Google LLC 1600 Amphitheatre Pkwy Mountain View CA 94043 USA

I need to extract just the message part: “Hello, this is a test message”

The content I want always sits between two markers. It starts after “–>” and ends before “play message”. These boundaries stay consistent across all emails.

What’s the best approach in Zapier to isolate this specific text and ignore everything else? Can I use a formatter step or custom code to achieve this?

Code by Zapier with JavaScript is your best bet here. Use this regex: text.match(/-->(.*?)play message/s) to grab everything between those markers. The s flag handles line breaks in the content.

I’ve parsed tons of similar emails - Google Voice format stays pretty consistent. Those CSS comments and “play message” text haven’t changed in the two years I’ve been using this approach.

Watch out for extra whitespace in the transcriptions though. Just add .trim() to clean it up: const message = text.match(/-->(.*?)play message/s)[1].trim().

Don’t forget error handling when the regex fails to match. I set up a fallback that routes the raw text to manual review.

Zapier text processing gets messy with complex patterns like this. I’ve done similar Google Voice extractions - multiple formatter steps beat a single regex every time. Use ‘Extract After’ to grab everything after ‘–>’, then pipe that into ‘Extract Before’ targeting ‘play message’. Two steps give you way more control and make troubleshooting actually possible. You can test each piece separately, which is huge. When Google tweaks their format (and they will), you just adjust one formatter instead of rebuilding the whole pattern. My complex regex broke three times in six months because of tiny HTML changes. Never again.

Zapier’s formatter won’t cut it for this pattern extraction. You’ll need Code by Zapier with JavaScript regex to grab what’s between “–>” and “play message”.

But here’s the problem - this workflow will break the moment Google tweaks their email format. And you’ll want to do more with that voicemail data eventually.

I built similar email parsing for our support tickets. Started with Zapier formatter, moved to custom code, but it became a pain maintaining it every time the email template changed.

Latenode actually solved this for me. Their text processing handles pattern extraction way better than Zapier’s formatter. You can set up regex patterns visually - no code needed - and it’s way more reliable for parsing structured emails.

The real win is expansion. Want to send the message to Slack? Log it somewhere? Trigger actions based on keywords? Latenode handles complex workflows without Zapier’s weird limitations.

Definitely worth checking out: https://latenode.com

The Problem:

You’re having trouble extracting the voicemail message from your Google Voice email notifications within Zapier. The message is consistently located between “–>” and “play message” markers, but you need a reliable method to isolate it, removing surrounding text and HTML tags.

TL;DR: The Quick Fix:

Use Zapier’s “Formatter” step with the “Extract Between” option. Set “–>” as the starting delimiter and “play message” as the ending delimiter. This directly extracts the desired message text without requiring custom code.

:gear: Step-by-Step Guide:

  1. Use the “Formatter” Step: In your Zapier workflow, add a “Formatter” step after the step that removes HTML tags from your Google Voice email.

  2. Select “Extract Between”: Choose the “Extract Between” option within the Formatter step’s configuration.

  3. Set Delimiters: In the “Extract Between” settings:

    • Start delimiter: Enter -->
    • End delimiter: Enter play message
  4. Test Your Zap: Run a test with a sample Google Voice email to verify that the “Formatter” step correctly extracts the message text (“Hello, this is a test message”).

:mag: Common Pitfalls & What to Check Next:

  • Whitespace: The extracted text might contain leading or trailing spaces. Add a subsequent “Formatter” step to use the “Trim” option to remove any extra whitespace.

  • Multiple Matches: If your email contains multiple instances of text between “–>” and “play message”, the “Extract Between” operation might extract more than you want. In this case, you might consider using Code by Zapier with a regular expression for more precise control.

  • Google Voice Email Format Changes: Google may occasionally update the format of their voicemail emails. If your workflow stops working, you’ll need to re-check the delimiters and potentially add more robust error handling (like checking if extraction was successful) in case Google’s format changes unexpectedly.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.