I have Hazel rules to sort and rename all my PDF invoices and receipts based on file name and contents of the PDFs.
Problem:
I have some fields in the PDF that I want to use when renaming the files, that in certain cases can take more than one form. I normally use a "contains match" and set that to a token, that I reuse when renaming. In this situation I can't use a nested rule, because it would lead to two different tokens, and I can't use logic to decide which one to use for renaming. Do I have to create two (or more) almost identical rules to match these different cases?
Example:
I have a bunch of receipts/invoices from Adobe. The invoice numbers follow 2 different patterns:
- A: xxxxxxxxx (only digits)
- B: IENxxxxxxx
I want to grab the invoice number of either form from the content of the PDF to be part of the final filename. Can I somehow make one rule to fit both of these?
PS.
This would be a good use case for allowing regex in tokens