Skip to main content
Best answer

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


michael291
Forum|alt.badge.img+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

Best answer by Troy Tessalone

@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.

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.

6 replies

Troy Tessalone
Forum|alt.badge.img+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


michael291
Forum|alt.badge.img+4
  • Author
  • Builder
  • 74 replies
  • May 3, 2021

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

etc.


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30982 replies
  • Answer
  • May 3, 2021

@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.


michael291
Forum|alt.badge.img+4
  • Author
  • Builder
  • 74 replies
  • May 3, 2021

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


  • New
  • 1 reply
  • July 20, 2021

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 ? 


nicksimard
Forum|alt.badge.img+11
  • Zapier Staff
  • 2115 replies
  • July 20, 2021

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!