At the moment I can only find the first instance — “Image 3884172” — but none after. Support didn’t have an answer and suggested this forum. Here’s an overview of my Zap setup:
New Gmail
Filter by sender (...@stocksy.com)
Formatter 1: Split text (find “Imagel:space:]”)
Formatter 2: Split text (find the number after (e.g. 3884172)
Send date of email and result (e.g. Image 3884172) to Slack
Send date of email and result (e.g. Image 3884172) to Google doc
Does this make sense? If so, how might I accomplish this? I’ve messed around with Looping and the “count” within Formatter but it doesn’t work. Thanks!
Page 1 / 1
Hmm, I wonder if there’s a way of achieving this using a code step.
@Troy Tessalone I know that you’re a wiz with parsing data using code, do you have any ideas?
Thanks @Danvers! @Troy Tessalone OMG that’s brilliant and I’m mad I didn’t think of it. Will try out, thanks!
@Troy Tessalone — Follow up question: I set up a new mailbox, forwarded an email to it, and created a template. Here’s a screenshot that points to the top 2 parsed patterns, and the email template to the right. I would just need to remove “Image:space:]” for this to work, pretty easy.
But here’s my question: the number following “Imagel:space:]” is going to change, and the quantity of that pattern (in this screenshot, there are 4) is also going to change. For example: one email might be just 1 pattern “Image 12345678” while another email might have 10. So how do I set up the email parser template to account for this?
Hey there, looks like there are a lot of good ideas here thus far. Here is another one involving Regular Expressions:
Just doing a bit of a quick and dirty test here with my input data, we can use RegEx to match whatever strings we want here with the pattern of:
(image\s\d{3})\s
To break this down a little bit:
The \s represents a space character
The \d represents any digit character
The {3} says I want 3 of the previous character in a row
...and the ( ) around the entire thing is called a Grouping which says “Give me these as output”
Here is our output:
Regular Expressions are one of the most powerful concepts in computers, something that is used across many programming languages, and is relatively consistent with regards to the patterns which are accepted across said languages.
In the case of your data, it looks like there would be 7 possible numbers in your Image strings you want to grab, so you would replace my 3 with 7 in the pattern shared above.
@RALaBarge That worked beautifully! Now the Zap is just down to 2 steps, love the simplicity.
Follow up: I was able to pluck out the pattern and the all instances (screenshot) but haven’t found a way to remove “Image :space:]” before the number, and splitting each # onto it’s own line. I tried Formatter/Split text and used “Imaged:space:]” as the Separator but it returns blank data.
The end goal is to have each URL to end with just the number, but right now it’s a URL with all the data:
Roger that, if you JUST needed the numbers and not the “Image” bit, you could modify your RegEx a bit to put the groupings around the numbers. If your string is:
image 1234567 - bla bla bla. Image 1234568 - blab blab blab ...
And if you just want the 1234567 your pattern could be:
image\s(\d{7})\s
I still keep the image string in my pattern to tell RegEx to expect this, to give it context as to where I want the 7 digits to be pulled from. I put my grouping around the digits only and this would give you an output of JUST digits.
This would leave you with a line item object of numbers...if you then needed to append them each to a URL, since it is a line item object you would need to either use Looping by Zapier or Google Sheets Make Multiple Rows or something that natively accepts our Line Item objects (as denoted by the description of the action in the Zap Editor).
Lets think about the Google Sheets method, your Zap could look like so:
Email Trigger => Formatter by Zapier Match Pattern => Google Sheets Make Multiple Rows
For the GSheets step, you would type in the base URL in a row and then map the output from the Line Item object after it, like you did above. This time we should just have a bunch of numbers to give you, and the GSheets step will make 1 URL from each number you give it in their own row.
That would let you generate those URLs individually and drop them into a sheet. From there you could have a 2nd Zap triggering off of New Rows to this new sheet to trigger off of each URL and then you can do whatever you want individually with them.
Let me know how it goes! =)
@RALaBarge That’s so elegant! I set everything up, turned it on and am waiting to see how it works. Thanks for the detailed guidance and swift RegEx formula!