From c013a759c3c457793102695390c9ab49712ecc04 Mon Sep 17 00:00:00 2001 From: Kinder Sung Date: Thu, 27 Aug 2015 10:34:06 +0800 Subject: [PATCH] Modify the regex so that it could parse multiple lines --- orm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orm.py b/orm.py index 29cea90..9a7164b 100644 --- a/orm.py +++ b/orm.py @@ -81,11 +81,11 @@ def parseCaseStep(case_step_txt): def parseStep(index, step_txt): step = {} step["instruction"] = step_txt[0].strip() - step["expected"] = step_txt[1].strip() + step["expected"] = step_txt[3].strip() step["number"] = index return step - regex = re.compile(ur'WHEN(.*?)\nTHEN([^\n]*)', re.IGNORECASE | re.DOTALL) + regex = re.compile(ur'WHEN((.(?!WHEN|THEN))*.)((?:THEN)((.(?!WHEN))*.)|)', re.IGNORECASE | re.DOTALL) steps = re.findall(regex, case_step_txt) case_step = []