I run a poker trainer, and the most requested feature was "show me my mistakes in real games". That means reading hand history files, the plain text logs poker sites write for every hand. I wanted to do it without uploading anyone's files, so everything below runs in the browser.
What a hand history looks like
Each hand is a block of text: a header with the hand id, stakes and date, the seats with stacks, then actions street by street, then the summary. PokerStars and GGPoker are close, but not identical. GGPoker hides opponents' cards unless they reach showdown, tournament headers carry the level and ante, and some rooms post a big blind ante as a single line.
The approach that worked
Split the file into hands by the header line, not by blank lines. The header is the one thing every hand reliably starts with.
Parse seats first and build a map from player name to seat.…