def __init__(self, project, section_file_matching=True):
self.kv_regex = re.compile(r'''<STR_LIT>''', re.VERBOSE)<EOL>self.project = project<EOL>tag_validation_regex = r'<STR_LIT>'<EOL>tag_validation_regex += '<STR_LIT>''<STR_LIT>'<EOL>for validator in list(project.tag_validators.values()):<EOL><INDENT>tag_validation_regex += '<STR_LIT>' % (validator.name,<EOL>validator.name.lower())<EOL><DEDENT>tag_validation_regex += '<STR_LIT>'<EOL>self.tag_validation_regex = re.compile(tag_validation_regex)<EOL>self.__section_file_matching = section_file_matching<EOL>
Lifted from
http://stackoverflow.com/questions/5323703/regex-how-to-match-sequence-of-key-value-pairs-at-end-of-string