blob: cb04b2d5e0032a9d3322b7bfceb747d0f477de19 (
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()
|