Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?!.*(?=(.))((.{9})+|(.(?!(?3)*$))+|(?(?=.(...)*$)(.(?!(.{27})*$)){7}|.)+)\1)
/

Description

Check if a sudoku board is valid or not. The board has to be as a single line. Seen at http://codegolf.stackexchange.com/questions/78210/regex-golf-verify-a-sudoku-solution

Submitted by anonymous - 9 years ago