From af9906c5fc7b22cfa5fd00381c7a98f4fe296ca7 Mon Sep 17 00:00:00 2001 From: ozgury Date: Wed, 20 Nov 2024 15:37:46 +0000 Subject: [PATCH] fix: isa table parser fix. --- metabolights_utils/isatab/default/parser/isa_table_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metabolights_utils/isatab/default/parser/isa_table_parser.py b/metabolights_utils/isatab/default/parser/isa_table_parser.py index 9dd506c..a719556 100644 --- a/metabolights_utils/isatab/default/parser/isa_table_parser.py +++ b/metabolights_utils/isatab/default/parser/isa_table_parser.py @@ -49,7 +49,9 @@ def fix_isa_table_file( ) file_content = re.sub(r"[\r\n][\r\n]+", r"\n", file_content) if fix_new_lines_in_cells: - new_line_in_cells_pattern = r'\t"([^\t]*)([\r\n]+)([^\t]*)"\t' + new_line_in_cells_pattern = ( + r'(^|\t)"([^"\t]*)([\r\n]+)([^"\t]*)"(\t|\n\|\r|$)' + ) find_new_lines_in_cells = re.findall( new_line_in_cells_pattern, file_content )