RegexWars
Tier 3 · Warlockcapture

The Clashing Digit

A Sudoku row is nine characters. Capture the digit that appears twice — and match nothing at all when the row is legal.

One character per cell, left to right. An empty cell is a full stop. Group 1 is the offending digit. Empty cells are not digits, so a row with two blanks in it has not broken any rule.

Your pattern0 chars · par 8
//
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases

Wrapped into rows of 9 so you can see the board. The string itself is one line with no line breaks in it — the 8 # between rows are ordinary characters, and a dot will happily match straight past them.

  • 123456788→ ["8"]
  • 123456789must not match
  • 1.34.6781→ ["1"]

    the pair is at opposite ends

  • 1.34.6789must not match

    two blanks are not a clash

+ 9 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.