Olof Johansson


Regexp::Common::Chess - regexp for algebraic notation in chess


 use Regexp::Common qw/Chess/;

 my $move = 'Rxh7+';
 if($move =~ /^$RE{Chess}{SAN}$/) {
         say "Yay! A valid chess move!";
 } else {
         say "Sad to say, that doesn't look valid...";


This module defines a regular expression for use when parsing standard algebaric notation (SAN) as specified in the Portable Game Notation (PGN) standard (export format). It is not a complete PGN regexp. It is limited to only match one specific move at a time.


The PGN format, including its SAN specification, is documented in the "Portable Game Notation Specification and Implementation Guide", available here:

The Regexp::Common manual documents the use of the Regexp::Common framework and interface, used by Regexp::Common::Chess.


The latest released code of this module is available from CPAN.

The latest development, useful for contributing and for those living on the edge etc. is available from Github:


 Copyright (c) 2011 - Olof Johansson <olof@cpan.org>
 All rights reserved.

 This program is free software; you can redistribute it 
 and/or modify it under the same terms as Perl itself.