from cgitb import html import re form = """
Open or close this module Study Status
Record Verification: April 2008 2017
Overall Status: Recruiting Completed
Study Start: March 2008
Primary Completion: December 2009 [Actual]
Study Completion: December 2009 [ Anticipated Actual]
First Submitted: April 10, 2008
First Submitted that
Met QC Criteria:
April 10, 2008
First Posted: April 15, 2008 [Estimate]
Results First Submitted: February 6, 2014
Results First Submitted that
Met QC Criteria:
August 29, 2014
Results First Posted: September 9, 2014 [Estimate]
Last Update Submitted that
Met QC Criteria:
April 10 18, 2008 2017
Last Update Posted: April 15, 2008 [Estimate] May 19, 2017 [Actual]
""" entry1 = """ Record Verification: April 2008 2017 """ drop_old_re = re.compile('\w*\s?') drop_new_re = re.compile('\w*\s?') drop_tags_re = re.compile('<[=-_,.:;"/\w\s]+>') print(drop_new_re.sub("",entry1)) print(drop_old_re.sub("",entry1)) print(drop_tags_re.sub("",entry1)) print(drop_tags_re.sub("",drop_new_re.sub("",entry1))) print(drop_tags_re.sub("",drop_new_re.sub("",form)))