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