Logistics
Bills of lading: references, vehicles, sender and receiver with addresses, cargo lines with count, kind and mass, and the totals, in whatever order the document states them.
ILLUSTRATIVE FREIGHT RECORD
Bill reference: 104512
Order reference: PO-88213
Dispatch date: 2026-11-09
Truck: 214
Trailer: 5302
Sender: Sample Parts Manufacturing Inc.
Origin: 100 Example Road, Windsor, ON
Sender order: SO-40718
Receiver: Sample Assembly LLC
Destination: 200 Sample Avenue, Detroit, MI
Cargo
12 skids of brake rotors; mass 4,800 kg
2 skids containing brake pads; mass 640 kg
Total: 14 packages; 5,440 kg
Seal: 1234567
Freight payment: Prepaidlogistics.ymlspec
$flags: [ CASE_INSENSITIVE, MULTILINE ] # Values Number: Grouped: $local: { Lead: '\d{1,3}', Group: '\d{3}', Fraction: '\d+' } $fields: lead: Lead groups: { $type: 'Group[]', $separator: ',' } fraction: Fraction $patterns: '#{lead},#{groups}(\.#{fraction})?' $value: '#{lead}#{groups}[.#{fraction}]' Plain: '\d+(\.\d+)?' Date: $local: Month: January: { $patterns: [ 'January', 'Jan\.?' ], $value: '01' } February: { $patterns: [ 'February', 'Feb\.?' ], $value: '02' } March: { $patterns: [ 'March', 'Mar\.?' ], $value: '03' } April: { $patterns: [ 'April', 'Apr\.?' ], $value: '04' } May: { $patterns: 'May', $value: '05' } June: { $patterns: [ 'June', 'Jun\.?' ], $value: '06' } July: { $patterns: [ 'July', 'Jul\.?' ], $value: '07' } August: { $patterns: [ 'August', 'Aug\.?' ], $value: '08' } September: { $patterns: [ 'September', 'Sept?\.?' ], $value: '09' } October: { $patterns: [ 'October', 'Oct\.?' ], $value: '10' } November: { $patterns: [ 'November', 'Nov\.?' ], $value: '11' } December: { $patterns: [ 'December', 'Dec\.?' ], $value: '12' } Year: '(19|20)\d{2}' MonthNumber: '0[1-9]|1[0-2]' Day: '0[1-9]|[12]\d|3[01]' $fields: { year: Year, month: MonthNumber, day: Day } $patterns: '#{year}-#{month}-#{day}' $value: '#{year}-#{month}-#{day}' Written: $local: { Day: '[12]\d|3[01]' } $fields: { month: Month } $patterns: - '#{day} #{month},? #{year}' - '#{month} #{day},? #{year}' WrittenShortDay: $local: { Digit: '[1-9]' } $fields: { month: Month, digit: Digit } $patterns: - '0?#{digit} #{month},? #{year}' - '#{month} 0?#{digit},? #{year}' $value: '#{year}-#{month}-0#{digit}' MassUnit: Kilogram: { $patterns: [ 'kgs?\.?', 'kilograms?', 'kilos?' ], $value: 'kg' } Pound: { $patterns: [ 'lbs?\.?', 'pounds?' ], $value: 'lb' } Tonne: { $patterns: [ 't', 'tonnes?', 'metric tons?' ], $value: 't' } MassLabel: '(gross )?(mass|weight|wt\.?)' Mass: $fields: { amount: Number, unit: MassUnit } $patterns: '#{amount} ?#{unit}' $value: { amount: '#{amount}', unit: '#{unit}' } PackageKind: Skid: { $patterns: 'skids?', $value: 'skid' } Pallet: { $patterns: [ 'pallets?', 'plts?\.?' ], $value: 'pallet' } Carton: { $patterns: [ 'cartons?', 'ctns?\.?' ], $value: 'carton' } Box: { $patterns: [ 'box', 'boxes' ], $value: 'box' } Crate: { $patterns: 'crates?', $value: 'crate' } Case: { $patterns: [ 'case', 'cases' ], $value: 'case' } Drum: { $patterns: 'drums?', $value: 'drum' } Bag: { $patterns: [ 'bags?', 'sacks?' ], $value: 'bag' } Bundle: { $patterns: 'bundles?', $value: 'bundle' } Roll: { $patterns: 'rolls?', $value: 'roll' } Tote: { $patterns: 'totes?', $value: 'tote' } Piece: { $patterns: [ 'pieces?', 'pcs?\.?' ], $value: 'piece' } Package: { $patterns: [ 'packages?', 'pkgs?\.?', 'handling units?' ], $value: 'package' } PaymentTerms: Prepaid: { $patterns: [ 'prepaid', 'pre-paid', 'PPD' ], $value: 'prepaid' } Collect: { $patterns: [ 'collect', 'COL' ], $value: 'collect' } ThirdParty: { $patterns: [ 'third party', '3rd party' ], $value: 'third party' } # Labelled lines of the document Reference: $local: Code: { $flags: [ -CASE_INSENSITIVE ], $patterns: '[A-Z0-9][A-Z0-9/-]*' } NumberWord: '( (no\.?|number|#))?' $fields: { code: Code } $patterns: '^${Label}${NumberWord}:? #{code}$' $value: '#{code}' Bill: { $local: { Label: [ 'Bill reference', 'Bill of lading', 'B/?L', 'BOL', 'Bill', 'Pro' ] } } Order: { $local: { Label: [ 'Order reference', 'Order', 'Purchase order', 'PO', 'Customer PO', 'Customer order' ] } } Truck: { $local: { Label: [ 'Truck', 'Tractor', 'Power unit', 'Unit' ] } } Trailer: { $local: { Label: [ 'Trailer' ] } } Seal: { $local: { Label: [ 'Seal' ] } } DispatchDate: $local: { Label: [ 'Dispatch date', 'Dispatched', 'Ship date', 'Shipped', 'Shipping date', 'Date shipped', 'Pickup date', 'Date' ] } $fields: { date: Date } $patterns: '^${Label}:? #{date}$' $value: '#{date}' FreightPayment: $local: { Label: [ 'Freight( payment| terms| charges)?', 'Payment terms', 'Terms' ] } $fields: { terms: PaymentTerms } $patterns: - '^${Label}:? #{terms}$' - '^#{terms} freight$' $value: '#{terms}' # Parties Party: $local: Name: '[^\d\n][^\n]*' Address: $local: Street: { $flags: [ -CASE_INSENSITIVE ], $patterns: '\d+[A-Za-z]?( [^,\n]+)' } City: '[^,\n\d]+' Region: { $flags: [ -CASE_INSENSITIVE ], $patterns: '[A-Z]{2}' } Postal: { $flags: [ -CASE_INSENSITIVE ], $patterns: [ '\d{5}(-\d{4})?', '[A-Z]\d[A-Z] ?\d[A-Z]\d' ] } Country: [ 'USA?', 'United States', 'Canada', 'Mexico' ] $fields: { street: Street, city: City, region: Region, postal: Postal, country: Country } $patterns: '#{street}, #{city},? #{region}( #{postal})?(,? #{country})?' Code: { $flags: [ -CASE_INSENSITIVE ], $patterns: '[A-Z0-9][A-Z0-9/-]*' } AddressLabel: [ 'Origin', 'Destination', 'Address', 'Pickup', 'Delivery', 'Ship from', 'Ship to' ] OrderLabel: '(order|PO|reference|ref\.?)( (no\.?|number|#))?' $fields: { name: Name, address: Address, order: Code } $patterns: '^${Label}: #{name}(\n((${AddressLabel}: )?#{address}|(${Label} )?${OrderLabel}: #{order}))*$' Sender: { $local: { Label: [ 'Sender', 'Shipper', 'Consignor', 'Ship from' ] } } Receiver: { $local: { Label: [ 'Receiver', 'Consignee', 'Recipient', 'Ship to' ] } } # Cargo CargoLine: $local: Description: '[^;\n]+?' Link: '(of|containing|with)' $fields: { count: Number, kind: PackageKind, description: Description, mass: Mass } $patterns: - '^#{count} #{kind}( ${Link})? #{description}([;,]? (${MassLabel}:? )?#{mass})?$' - '^#{description}: #{count} #{kind}([;,]? (${MassLabel}:? )?#{mass})?$' Totals: $before: CargoLine $local: Total: 'totals?' $fields: { packages: Number, kind: PackageKind, mass: Mass } $patterns: - '^${Total}:? (#{packages} #{kind}([;,]? #{mass})?|#{mass})$' - '^(${Total} (#{kind}:? #{packages}|${MassLabel}:? #{mass})\n?)+$' # The document Shipment: $local: { Other: '[^\n]+' } $fields: bill: Reference::Bill order: Reference::Order dispatchDate: DispatchDate truck: Reference::Truck trailer: Reference::Trailer sender: Party::Sender receiver: Party::Receiver cargo: 'CargoLine[]' totals: Totals seal: Reference::Seal payment: FreightPayment $patterns: '^((#{bill}|#{order}|#{dispatchDate}|#{truck}|#{trailer}|#{sender}|#{receiver}|#{cargo}|#{totals}|#{seal}|#{payment}|${Other})\n*)+'
$ texomy parse input.txt -m logisticsAbout this spec
Bills of lading and freight records: references, dispatch date, truck and trailer, sender and receiver with address and order number, cargo lines with package count, kind, description and mass, totals, seal and freight payment terms.
Package files
logistics.ymlsamples/bill-of-lading.txtsamples/compact-bol.txtsamples/freight-record.txtsamples/memo.txttests/expected/bill-of-lading.yamltests/expected/compact-bol.yamltests/expected/freight-record.yamltests/expected/input.yamltests/expected/memo.yamltests/lines.test.ymltests/logistics.test.ymltexomy.json
55 nodes from 1 top-level matches.
Run it yourself
Save the example from Studio to a folder, then in that folder:
texomy parse input.txt -m logisticstexomy testMore examples
Invoices
Supplier, invoice number, dates, amounts, payment terms and order references, plus charge rows that take their section from the table caption.
Bank statements
Account, period and balance summary, and transactions read from a table whose Debit and Credit columns give each amount its sign.
Education
Student, identifier, institution and print date in any order, and each term with its courses, grades, credit hours and totals.
Resumes
Candidate name, headline and contacts, each job and degree with its own dates, courses, and skills grouped under their area.
Addresses
Address blocks and one-line addresses: recipient, street or post office box with building, suite or mail stop, city, state, postal code and country.
Insurance claims
Explanation of Benefits tables: each claim line with service dates, description, status and every amount in its own field, the totals line as a type of its own, and the remark codes explained below.
Write the spec once. Run it on everything.
Install the CLI, connect your agent, and turn your first sample into typed data in minutes.
brew install texomy/tap/texomy