main_48.py 459 B

12345678910111213
  1. def pseudonymize(self, content):
  2. if not content: return content
  3. content_modified = ''
  4. start = 0
  5. for mo in re.finditer("\[\*\*[^\[]*\*\*\]", content):
  6. replacement = self.mapper.get_mapping(mo.group(0))
  7. content_modified += content[start: mo.start()]
  8. content_modified += replacement
  9. start = mo.end()
  10. if start < len(content):
  11. content_modified += content[start: len(content)]
  12. return content_modified