main_36.py 258 B

123456
  1. def regex_anonymizer(self, text: str, regex: Pattern, provider: str) -> str:
  2. '''
  3. Anonymize all substring matching a specific regex using a Faker provider
  4. '''
  5. matchs = re.findall(regex, text)
  6. return self.replace_all(text, matchs, provider)