input.txtHover a value to see its type · click it to find it in the treeRun in Studio ↗
SAMPLE BANK STATEMENT
Cedar Valley BankStatement period: 9/25/2023-10/22/2023Account: 004182337Account holder: Little Oaks Child Care CenterOpening balance: $42,316.20Money deposited: $58,940.75Money withdrawn: $47,208.31Closing balance: $54,048.64
Date Description Reference Debit Credit
9/25/23Check # 3105214$1,280.009/25/23Check # 3106215$912.459/26/23Northwest Payroll Services216$58.209/27/23City Waste Services217$126.909/28/23Office Supply Online218$342.189/29/23Fresh Foods Market219$587.6410/1/23Transfer - credit card220$1,046.3310/1/23State Nutrition Program221$3,875.10
bank-statements.ymlspec
# Bank statements: the bank, account, holder and period of a statement, its balance summary and its# transactions. Consumers select nodes by type.## Transactions come from a table whose header names its columns, where an unsigned amount under Debit or# Credit takes its sign from the column, or from a line whose amounts carry their own sign. Slash dates# are read month first.$imports: [ 'values' ]
$flags: [ CASE_INSENSITIVE, MULTILINE ]
# The title of a statement, so that 'Your Bank Statement' is not read as a bank named 'Your Bank'.StatementTitle: '(your|our|my|this) (bank |account )?statement'Bank:
$flags: [ -CASE_INSENSITIVE ]
$local: { Word: "[A-Z][A-Za-z&'-]*" }
# Cedar Valley Bank, First Harbor Credit Union, Northwind Savings Bank, Acme Bank, N.A.Named: '(${Word} )+(Bank|Credit Union|Trust Company)(,? N\.A\.)?'# Bank of NorthshireBankOf: 'Bank of( the)?( ${Word})+'AccountNumber:
$local:
Label: [ 'account', 'account number', 'account no\.?', 'account #', 'acct\.?', 'acct\.? #', 'acct\.? no\.?' ]
Number: '[A-Za-z0-9*][A-Za-z0-9* -]*[0-9]'$fields: { number: Number }
$patterns: '^${Label}:? *#{number} *$'AccountHolder:
$local:
Label: [ 'account holder', 'account name', 'account owner', 'customer name', 'name on account', 'prepared for' ]
Name: '\S([^\r\n]*\S)?'$fields: { name: Name }
$patterns: '^${Label}:? +#{name} *$'StatementPeriod:
$local:
Label: [ 'statement period', 'period', 'statement dates', 'for the period', 'period covered' ]
Through: [ '-', '–', 'to', 'through', 'thru' ]
$fields: { start: Date, end: Date }
$patterns: '${Label}:?( from)? +#{start} *${Through} *#{end}'$value: { start: '#{start}', end: '#{end}' }
BalanceFigure:
$local:
Figure:
Opening:
$value: 'opening'$patterns:
- '(opening|beginning|starting|previous) balance'
- 'balance (brought )?forward'Deposits:
$value: 'deposits'$patterns:
- 'money deposited'
- 'money in'
- '(total )?deposits( and (other )?(credits|additions))?'
- '(total )?credits'
- 'paid in'Withdrawals:
$value: 'withdrawals'$patterns:
- 'money withdrawn'
- 'money out'
- '(total )?withdrawals( and (other )?(debits|subtractions))?'
- '(total )?debits'
- 'checks and (other )?debits'
- 'paid out'Closing:
$value: 'closing'$patterns:
- '(closing|ending|new) balance'
- 'balance carried forward'Count: '\d+'# spaces, tabs or dot leaders between the label and the amountLeader: '[ \t.]+'$fields: { figure: Figure, date: Date, count: Count, amount: Money }
$patterns: '^#{figure}( (on|as of) #{date})?:?( *\(#{count}\))?${Leader}#{amount} *$'$value:
figure: '#{figure}'date: '[#{date}]'count: '[#{count}]'amount: '#{amount.amount}'currency: '[#{amount.currency}]'Transaction:
$local:
Description: '[^\r\n]+?'Reference: '[A-Za-z]*\d[A-Za-z0-9-]*'# spaces or tabs between columnsGap: '[ \t]+'DateHeader: 'Date'DescriptionHeader: [ 'Description', 'Details', 'Particulars' ]
ReferenceHeader: [ 'Ref(erence)?', 'Check ?#' ]
DebitHeader: [ 'Debit', 'Withdrawals?', 'Money out' ]
CreditHeader: [ 'Credit', 'Deposits?', 'Money in' ]
AmountHeader: 'Amount'BalanceHeader: 'Balance'$fields:
date: Datedescription: Descriptionreference: Referencedebit: Moneycredit: Moneyamount: Moneybalance: Moneyamounts: { $type: 'Money[]', $separator: '${Gap}' }
# A table whose header names its columns: an unsigned amount under Debit or Credit takes its sign# from its column; an amount under Amount carries its own sign.$tables:
$columns:
date: DateHeaderdescription: DescriptionHeaderreference: ReferenceHeaderdebit: DebitHeadercredit: CreditHeaderamount: AmountHeaderbalance: BalanceHeader# A line without such a header: the amounts carry their own sign.$patterns: '^#{date}${Gap}#{description}(${Gap}#{reference})?${Gap}#{amounts}[ \t]*$'$value:
date: '#{date}'description: '#{description}'reference: '[#{reference}]'amount: '[-#{debit.amount}][#{credit.amount}][#{amount.amount}][#{amounts.0.amount}]'currency: '[#{debit.currency}][#{credit.currency}][#{amount.currency}][#{amounts.0.currency}]'balance: '[#{balance.amount}][#{amounts.1.amount}]'
$ texomy parse input.txt -m bank-statements
About this spec
Bank statements: the bank, account, holder and period, the balance summary, and transactions from a table whose header names its columns or from lines whose amounts carry their sign.
Package files
bank-statements.yml
texomy.json
values.yml
samples/eu-savings.txt
samples/invoice-not-statement.txt
samples/uk-bank.txt
samples/us-credit-union.txt
tests/bank-statements.test.yml
tests/samples.test.yml
tests/values.test.yml
162 nodes from 16 top-level matches.
Run it yourself
Save the example from Studio to a folder, then in that folder: