Best answer

Regular Expression - pattern extract based on previous word?

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

3 replies

Userlevel 7
Badge +12

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

Userlevel 7
Badge +12

@PeterCera 

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

 

 

RESULTS

 

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

Reply