Skip to main content
Question

How can I filter emails by subject line format and save to matching folder?

  • 19 July 2024
  • 4 replies
  • 15 views

Hi, 

I’m new to Zapier and exploring a way to automate email saving. 

I wanted to know if it was possible to set up a workflow that filtered emails not on the presence of a  specific piece of text or data but on whether the subject line contained text matching a certain format - ABC123 (so it could be FOR013 or JPL149, or anything similar). This is how we set up our job numbers so it would be useful to understand whether it’s to receive an email, parse that it contains this format of code, and then save it into a relevant folder which matches the job number. 

Thanks for any help you can give me.

 

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @littleone91 

Which email app are you trying to use?

Gmail and Outlook have triggers for: Email Matching Search

Or you can add a Filter as step 2: https://zapier.com/apps/filter/help

 

 

Userlevel 7
Badge +5

Hi @littleone91 ,

 

We just wanted to see how everything is going with your Zap. Did Troy's recommendation get the job done? If you need any assistance, feel free to reach out. We're happy to address any concerns and assist you.

We're looking forward to your response.

Hi @Troy Tessalone if I use Email matching search, how can I use AQS to ensure the search is for a pattern rather than for a particular string of text? I know the regex of the pattern but not sure how to insert it into this field?

Userlevel 7
Badge +11

Hey there @littleone91!

Hope you don’t mind me popping in to lend a hand with this. 🙂

Looking at the AQS guide, linked to in the help text under that Search terms field, I’m not seeing regex patterns mentioned there: Search Mail and People in Outlook.com > Use Advanced Query Search to refine results. I tried using a regex pattern in that Search terms field on the New Email Matching Search trigger and got an error saying the “An unrecognized escape sequence '\s' was found”. So it looks like using regex with that trigger isn’t currently supported. I’d suggest reaching out to our Support team here to submit a new feature request for regex patterns to be supported by the New Email Matching Search trigger. 

In the meantime, perhaps you could use a Formatter (Text > Extract Pattern) action (see: Find text with regular expressions in Zaps) and use the regex pattern there to search for a match. Then you could follow that up with a filter (see: Add conditions to Zaps with filters) to only allow the Zap to run if the Formatter action was able to find a match. 

Do you think that approach could work?