Skip to content

Commit 540fe0e

Browse files
committed
Make actual moves optional in regex per spec. This also indirectly resolves an issue with the termination parsing as a header when there are no moves.
1 parent 34e9627 commit 540fe0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chess.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ var Chess = function(fen) {
13541354
options.newline_char : '\n';
13551355
var regex = new RegExp('^(\\[(.|' + mask(newline_char) + ')*\\])' +
13561356
'(' + mask(newline_char) + ')*' +
1357-
'1\.(' + mask(newline_char) + '|.)*$', 'g');
1357+
'(?:1\.)?(' + mask(newline_char) + '|.)*$', 'g');
13581358

13591359
/* get header part of the PGN file */
13601360
var header_string = pgn.replace(regex, '$1');

0 commit comments

Comments
 (0)