Skip to content

Commit 77794ce

Browse files
laniakea64niklasf
authored andcommitted
pgn: Improve validation of symbol tokens for tag names
1 parent 43dc84a commit 77794ce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

chess/pgn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393
NAG_NOVELTY = 146
9494

9595

96-
TAG_REGEX = re.compile(r"^\[([A-Za-z0-9_+#=:-]+)\s+\"([^\r]*)\"\]\s*$")
96+
TAG_REGEX = re.compile(r"^\[([A-Za-z0-9][A-Za-z0-9_+#=:-]{,254})\s+\"([^\r]*)\"\]\s*$")
9797

98-
TAG_NAME_REGEX = re.compile(r"^[A-Za-z0-9_+#=:-]+\Z")
98+
TAG_NAME_REGEX = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_+#=:-]{,254}\Z")
9999

100100
MOVETEXT_REGEX = re.compile(r"""
101101
(

0 commit comments

Comments
 (0)