Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^((?:[NBRQK]([a-h1-8])?x?(?!\2)[a-h](?!\2)[1-8]|[NBRQK]x?[a-h][1-8]|(?:[a-h]x)?[a-h](?:[1-8](?:\(ep\))?|[18]=[NBRQ])|(?:0-){1,2}0)\+{0,2})$
/

Description

Detects SYNTACTICALLY correct chess moves (i.e. it doesn't check whether the move itself is actually valid)

Submitted by Terence Linnell - 9 years ago