Best answer

Extract Amazon Order ID with Formatter


Hi, I need help with extracting an Amazon order number from the field where people are asked to put the order number. 

Amazon order numbers consist of numbers only and have the following format - 11X-YYYYYYY-YYYYYYY. I need to have the value in this exact format.

They all start with “11”. 

“X” can be just 1 or 2 or 3 or 4. 

“Y” can be any number. 

Dash “-” is necessary after the first 3 numbers and then after next 7 numbers again.

People send me their order numbers in different formats like:

  • 114-1234567-1234567 (the correct format);
  • 11412345671234567 (without dashes);
  • order 114-1234567-1234567 (with text);
  • order 11412345671234567 (with text without dashes);
  • order #11412345671234567 (text and # sign);
  • #114-1234567-1234567 (with number sign);
  • 114-12345671234567 (with just one dash);
  • any combination of the above.

I need to make sure I get the order number in the proper format no matter how I received it. 

Any help would be greatly appreciated.

icon

Best answer by steph.n 17 June 2020, 02:36

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

Userlevel 7
Badge +8

Hi @redgar - Thanks for being very patient. We do not offer any assistance with regex. However, I would like to surface that we do have a Work Offered area as well as Zapier Experts area that accepts work like you’re seeking to have done. https://zapier.com/experts/ 

Please let us know how we may be of further help.

Thanks, Danvers.

Unfortunately, I am not confident with regex either, so I was hoping someone could help with that. I am even willing to pay for a solution that will work for me. 

Userlevel 7
Badge +11

Hi @redgar! This might be possible using the Formatter’s ‘Extract Pattern’ function - which allows you to use a regular expression (Regex) to tell the step which type of pattern pull out of the text. 

 

This blog post explains how you can use Regex to extract specific pieces of information from text: How to extract email addresses, phone numbers and links from text

 

The tricky part will be finding the correct expression that will be able to pull out the information that you need. I’m not particularly confident with regex, so perhaps someone else in the Community can help with this one.