From 8d4c5a2db84cf71298acf7078e98a15a340d64f9 Mon Sep 17 00:00:00 2001 From: Jacques Grelet <jacques.grelet@ird.fr> Date: Mon, 6 Dec 2010 09:49:06 +0000 Subject: [PATCH] Format .ini change with version SODA 1.1 1.0 PLATFORM_NAME=Nuka Arctica 1.1 PLATFORM_NAME = "Nuka Arctica" Modify regexp that works in all versions use quantifier none greedy (.*?) remove double quote from experssion : ["]* --- tsg_io/readTsgIniLabview.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tsg_io/readTsgIniLabview.m b/tsg_io/readTsgIniLabview.m index 251b82c..f7e0d24 100644 --- a/tsg_io/readTsgIniLabview.m +++ b/tsg_io/readTsgIniLabview.m @@ -64,8 +64,10 @@ while ~feof(fid) % construct regex with pair cle=value % and extract value - % ------------------------------------ - regex = strcat('^\s*', clef, '\s*=\s*(.+)$'); + % use quantifier none greedy (.*?) + % remove double quote from experssion : ["]* + % --------------------------------------------------- + regex = strcat('^\s*', clef, '\s*=\s*["]*(.+?)["]*$'); match = regexp( str, regex, 'tokens'); % build tsg struct @@ -101,10 +103,10 @@ while ~feof(fid) % CNDC_LINCOEF_OFFSET=0.00000000E+0 % ------------------------------------ if ~isempty(strfind(clef, 'COEF')) - regex = strcat('^\s*', clef, '_(\w+)?\s*=\s*(.*)$'); + regex = strcat('^\s*', clef, '_(\w+)?\s*=\s*["]*(.*?)["]*$'); match = regexp( str, regex, 'tokens'); elseif ~isempty(strfind(clef, 'DEPH')) - regex = strcat('^\s*', clef, '\s*=\s*(.*)$'); + regex = strcat('^\s*', clef, '\s*=\s*["]*(.*?)["]*$'); %regex = strcat('^\s*\w*_DEPH_?\w*\s*=\s*(\w.+)$'); match = regexp( str, regex, 'tokens'); else -- GitLab