Has X Won?
A noughts and crosses board arrives as one flat string. Match it only when X has three in a row — across, down, or diagonally.
The board is flattened row by row, top-left first, with . for an empty square. Between one row and the next sit 2 hash characters — one fewer than the width. That padding is the whole trick: it makes every direction a fixed stride. Left to right is 1 apart, straight down is 5, the down-right diagonal is 6, the down-left diagonal is 4 — and a diagonal that would fall off the edge lands on a hash instead of wrapping onto the next row. Eight lines, four strides.
Wrapped into rows of 3 so you can see the board. The string itself is one line with no line breaks in it — the 2 # between rows are ordinary characters, and a dot will happily match straight past them.
must matchXXX##.O.##O..top row
must matchX.O##X.O##X..left column
must matchXO.##OX.##..Xdiagonal
must not matchXOX##XOO##OXXa full board nobody won
must not match.X.##X..##.X.three X, but not in a line
must not matchOOO##X.X##.X.O won, not X
+ 12 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.