From 8d59413d1419785e985b01e98d8ed61571203667 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Sat, 18 May 2024 21:11:41 +0900 Subject: [PATCH] Fixup overescaped regexes --- src/dendropy/dataio/nexusprocessing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dendropy/dataio/nexusprocessing.py b/src/dendropy/dataio/nexusprocessing.py index 3d1fb8c2..a2f9edbc 100644 --- a/src/dendropy/dataio/nexusprocessing.py +++ b/src/dendropy/dataio/nexusprocessing.py @@ -480,9 +480,9 @@ def escape_nexus_token(label, preserve_spaces=False, quote_underscores=True): return "" if not preserve_spaces \ and "_" not in label \ - and not re.search(r'''[\(\)\[\]\{\}\\/\\,\\;\\:\\=\\*'"\`\+\-\<\>\0\t\n]''', label): + and not re.search(r'''[()[\]{}\\\/,;:=*'"`+\-<>\\0\\t\\n]''', label): label = label.replace(' ', '_').replace('\t', '_') - elif re.search(r'''[\(\)\[\]\{\}\\/\,\;\:\=\*'"\`\+\-\<\>\0\t\n\r ]''', label) \ + elif re.search(r'''[()[\]{}\\\/,;:=*'"`+-<>\0\t\n\r ]''', label) \ or quote_underscores and "_" in label: s = label.split("'") if len(s) == 1: