Skip to main content
Bankflow

Merchants, categories & rules

How to Write Rules That Categorize and Tag Transactions

Rules link transactions to merchants, categories, and tags automatically. How patterns match, how to narrow a rule, what happens when two rules disagree, and how rules treat your manual edits.

Last verified in Bankflow on September 14, 2026.

What a Rule Does

A rule is a set of text patterns that, when a transaction's description matches, links the transaction to a merchant, puts it in a category, or adds a tag. Rules are what let Bankflow categorize next month's statement the way you categorized this one, without you doing it again.

There's no separate rules page. Each rule belongs to the thing it assigns, and you manage it there:

  • On Merchants, a merchant's rules decide which transactions are linked to it.
  • On Categories & Tags, a category's rules put transactions in that category, and a tag's rules add that tag.

Choose Manage rules from any merchant, category, or tag. The rules are listed on the right; click one to edit it, or click Add rule.

Rules You Already Have

Every merchant, category, and tag starts with a rule matching its own name. That's why a new category called "Netflix" immediately picks up transactions that mention Netflix. When Bankflow recognises a merchant automatically, it saves the rule it used, so the next transaction from that merchant matches straight away. These rules work exactly like ones you write yourself, and you can edit or delete them.

How Patterns Match

A rule matches a transaction when any of its include patterns appears in the description, and none of its exclude patterns do.

  • Include patterns: the different ways the same thing shows up on statements. For Amazon, that might be amazon, amzn, and amazon.in.
  • Exclude patterns: text that rules a match out. Add refund or reversal so a returned order doesn't count as a purchase.

By default, matching ignores capitals, spaces, accents, and punctuation, and a pattern can match part of a word: uber matches "UBER *TRIP" and "UBEREATS". Two switches beside each pattern tighten that:

  • Whole word only matches the pattern as a complete word, so uber no longer matches "UBEREATS".
  • Case makes the match case-sensitive.

Narrowing a Rule

A pattern that's right for one account can be wrong for another. Under Context filters and Source scope, a rule can be limited to:

  • Transaction type: only money in, or only money out. A "salary" rule shouldn't catch a payment you sent with salary in the reference.
  • Sources: only certain banks or statements, or everything except them.
  • A merchant (category rules): only transactions already linked to that merchant. Use this to put one merchant's purchases in a category without catching other transactions with similar text.
  • Existing categories and tags (tag and merchant rules): only transactions that are, or aren't, in a category or carrying a tag.

Category rules can also set a subcategory.

When Rules Apply

Saving a rule applies it to your existing transactions straight away, and it applies to every future import. On import, your rules run first; automatic categorization and merchant recognition only handle what your rules didn't match.

Anything you set by hand is left alone. If you changed a transaction's category yourself, no rule or automatic process will change it back.

When Two Rules Disagree

Bankflow won't let two rules give the same text two different answers. If you add a pattern that another rule already uses for a different merchant, category, or tag, and their scopes overlap, the rule isn't saved, and you're asked to resolve the conflict first. The same pattern is fine when the scopes can't overlap, for example one rule for money in and another for money out, or rules limited to different banks.

Longer patterns take precedence over shorter ones they contain. A category rule for amazon prime wins over one for amazon, so Prime lands in Subscriptions while other Amazon purchases land in Shopping. Tags are different: a transaction can carry several, so every matching tag rule adds its tag.

Examples

GoalWhereRule
Group every Amazon spelling under one merchantMerchants, AmazonInclude amazon, amzn; exclude refund
Put rent in HousingCategories, HousingInclude your landlord's name; money out only
Tag expenses to reclaim from workTags, ReimbursableInclude uber, hotel; only from your work card
Treat salary as income onlyCategories, SalaryInclude salary, payroll; money in only

Next Step

Rules shape what you see on Merchants and Categories & Tags. To fix a transaction your rules got wrong, change it by hand on the Transactions page; your choice sticks.