Link to home
Start Free TrialLog in
Avatar of acave
acave

asked on

Case insensitive Find

Python is used to parse report text. Text between certain keywords are stored to Db. Like:

value = reportText[(reportText.find('FINDINGS:'))+9:reportText.find('IMPRESSION:')]
value = value.rstrip()
value = value.lstrip()

Is used to get the text between the FINDINGS: and IMRESSION: and later, store the text in the findings column. I cannot get the other party to protect the report template or send me the data pre-parsed. Often someone will change FINDINGS: to Findings: which breaks the above. I must preserve the case of the reportText.

How can I accomplish the same parsing task but make it so the find is case insensitive?  
ASKER CERTIFIED SOLUTION
Avatar of ramrom
ramrom
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Correction: use re.search instead of re.match
Avatar of acave
acave

ASKER

Thanks ramrom, love simplicity. Thanks mish33, got me thinking about encapsulation and reuse. I combined your answers to build a good solution.