I'm grabbing my Amazon order history, page by page.
Every page gets appended to a text file.
I end up with a long text file which contains all of my orders.
Now I want to grab the order sum of each one of these orders, and add them up together.
They look like this:
I'll have hundreds of occurrences in the text file.
I can find them with this regex pattern:
But what's the most elegant way to have KBM go through the file once, grab each occurrence, and add it to one variable (let's say AmazonSpending2017)?
I thought about running a loop: Grab the first match. Add it to my results variable. Then delete the occurrence. And run the same loop again and again, until the pattern cannot be found anymore.
Is there a more elegant way to do this?
The comma might need to be replaced by a period. I'm using Amazon in Germany, which also doesn't have the CSV reporting tool that the US version has - hence my need for a KBM solution. But it's a problem that interests me in general, because I come across it often - how to deal with multiple occurrences of a regex match.