Best answer

Regular Expression - pattern extract based on previous word?

  • 2 December 2021
  • 3 replies
  • 283 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?

icon

Best answer by Troy Tessalone 2 December 2021, 17:42

View original

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

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

Userlevel 7
Badge +14

@PeterCera 

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

 

 

RESULTS

 

Userlevel 7
Badge +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