diff --git a/tsplib95/models.py b/tsplib95/models.py index 1eb7223..53238bb 100644 --- a/tsplib95/models.py +++ b/tsplib95/models.py @@ -98,7 +98,7 @@ def parse(cls, text, **options): """ # prepare the regex for all known keys keywords = '|'.join(cls.fields_by_keyword) - sep = r'''\s*:\s*|\s*\n''' + sep = r'''\s*:\s*|\s*\n|\Z''' pattern = f'({keywords}|EOF)(?:{sep})' # split the whole text by known keys