Category Rules: Writing Patterns That Work
Category rules are the keyword patterns behind automatic expense categorization. This page covers how to write them, how matching works on messy bank descriptions, and how to fix a rule that catches too much.
How matching works
A rule matches when its keyword appears anywhere in the transaction description, ignoring case. Bank descriptions are messy, which is exactly why partial matching helps:
- "SQ *YOGA STUDIO" (Square payment processor prefix)
- "AMZN MKTP US" (abbreviated Amazon Marketplace)
- "SHELL #5678 PORTLAND OR" (store number and location)
The pattern "AMZN" catches every Amazon variant above; "SHELL" catches every station.
Write a rule in 3 steps
Rule priority: specific beats general
When two rules match the same transaction, the more specific pattern wins. A common use:
- "AMAZON" → Shopping
- "AMAZON PRIME" → Subscriptions
A Prime charge matches both, but the longer pattern takes it, so your subscription total stays accurate.
Fixing common problems
- Rule matches too much: "COFFEE" also catches a bar named "Coffee & Cocktails". Replace it with the exact merchants you visit.
- Merchant slips through: The same company can bill under several names (Shell and Esso, for example). Add a rule per billing name.
- Duplicate rules: Review your rule list occasionally and delete overlaps. Deleting a rule never changes already-categorized transactions.
Start with five rules
Cover your grocery store, top subscription, gas station, favorite restaurant, and phone bill. That alone categorizes most months.
Try ZenExpenses ↗