Hazel Rule for Hertz Receipts

Posted on

Tagged as computing, OS X and hazel

This article is a specific im­ple­men­ta­tion of the concepts discussed in Hazel for Expense Receipts.

This rule sorts an emailed receipt from Hertz Rent-A-Car into a folder named for the year and month of the last day of the rental.

These are the details:

Rule Overview

We just check that the document is from Hertz, and then try to pick out the correct date.

Content for Match Pattern

We have to look for a date (in the pattern below) that follows the word "Date", a colon, and some amount of other text. The first occurrance in the file is used, because this is the date that the receipt was generated (which is always the last day of the rental).

Date Pattern for Match

The pattern for this match, which is named to reflect what it matches. So two-digit month (zero padded), one digit day (no padding), four digit year -- all separated by slashes.

Token Re-Use for Sorting

This just shows that you can reference the matched text from the "match" area in the "action" area.

Date Patern Changed for Sorting

Here we can see that the date pattern has been altered for use -- it's been re-ordered, and the day has been removed.

FairTax OS X TSA acrylamid applescript computing food frugal government hazel js music woodworking