Best answer

Is it possible to extract an invoice number from an email subject?


Userlevel 4
Badge +4

Hello, I am trying to extract an invoice number that is mentioned in the email subject (i.e. INV00001). And I do need the whole invoice number containing the INV plus 00001). 

Is this possible with a Python or Javascript, Regex or something like that? 

Thanks for help, 
Michael

icon

Best answer by Troy Tessalone 3 May 2021, 20:12

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.

6 replies

Userlevel 7
Badge +14

@michael291

What is an example of the subject line template?

Article about using Formatter > Text > Extract Pattern: https://zapier.com/help/create/format/find-text-with-regular-expressions-in-zaps

Userlevel 4
Badge +4

Hi @Troy Tessalone the subject line is: 
Here is Invoice No. INV00001
Here is Invoice No. INV00002
Here is Invoice No. INV00003

etc.

Userlevel 7
Badge +14

@michael291

If the Invoice ID is always at the end just use a Formatter > Text > Split action to split at “No. ” and keep the second/last segment.

Userlevel 4
Badge +4

@Troy Tessalone Perfect!!! I did use Formatter > Text > Split > Use as separate fields to solve this problem. Many thanks!!!

Hello,

I have the same issue.

I want extract the order number. The order number is in the email subject like that : alibalabe : expeditition order n°234234254 _4396__

 

I need this number : _4396__

 

How can i do what i want ? 

Userlevel 7
Badge +11

Hi@Kenzo!

If you’re not familiar with code or using Extract Pattern, you could use a couple of Formatter steps:

  1. The first would split on the _ to get you 4396__ (you would use the last portion)
  2. The second would split on __ to get you 4396 (you would use the first portion)

A more efficient way would be to use something like this Formatter — Text — Extract Pattern step:

I used this in the Pattern field: \_(.*?)\__

Hope that helps!