Skip to main content
Best answer

Regular Expression - pattern extract based on previous word?

  • December 2, 2021
  • 3 replies
  • 295 views

Hi folks, I’m struggling to figure out a very specific regex pattern matcher. I need to extract some question answers from an email job application using the plain text field extracted from the email. These are single word answers as so:

This is an employer-written question. You can report inappropriate questions to Indeed through the 'Report job' link at the bottom of the job description. 'Do you have experience providing care in the UK?'

Yes

This is an employer-written question. You can report inappropriate questions to Indeed through the 'Report job' link at the bottom of the job description. 'What is the first half of your postcode?'

Wv12

This is an employer-written question. You can report inappropriate questions to Indeed through the 'Report job' link at the bottom of the job description. 'Do you drive and have access to a vehicle?'

Yes

This is an employer-written question. You can report inappropriate questions to Indeed through the 'Report job' link at the bottom of the job description. 'What is your mobile number?'

07490128369

 

I’ve been trying:
(?<=vehicle\?\'\s).*(?=This is)
vehicle\?\'(\w+)

 

But no luck. Any ideas?

Best answer by Troy TessaloneBest answer by Troy Tessalone

@PeterCera 

Here’s an alternative using a JavaScript Code step: https://zapier.com/apps/code/help

 

 

RESULTS

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Forum|alt.badge.img+14

Hi @PeterCera 

Some other options to try with email parsing…

Email Parser by Zapier: https://zapier.com/apps/email-parser/integrations#triggers-and-actions

Mailparser: https://zapier.com/apps/mailparser/integrations#triggers-and-actions


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30948 replies
  • Answer
  • December 2, 2021

@PeterCera 

Here’s an alternative using a JavaScript Code step: https://zapier.com/apps/code/help

 

 

RESULTS

 


  • Author
  • Beginner
  • 6 replies
  • December 6, 2021

Thanks so much @Troy Tessalone - really helpful to see a java solution - it’s more elegant than regex for sure!