blob: 2d6a6f65f4827cc08c97d1dd249902c201c02c97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import re
class RedactPhoneNumbers:
def __init__(self, stream):
self.stream = stream
def write(self, text):
# Regular expression to match phone numbers
#phone_regex = r"(\+\d{1,2}\s?)?1?\-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}"
#redacted_text = re.sub(phone_regex, "****", text)
self.stream.write(text)
def flush(self):
self.stream.flush()
|