-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cliff Hill <[email protected]>
- Loading branch information
1 parent
452ab7e
commit 278541f
Showing
1 changed file
with
2 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
logger = logging.getLogger(__name__) | ||
|
||
_phone_regex = re.compile("(?:\\+ *)?\\d[\\d\\- ]{7,}\\d") | ||
_email_regex = re.compile(r"[\w\.-]+@[\w\.-]+") # ['[email protected]', '[email protected]'] | ||
|
||
|
||
def _scrub(msg: Any) -> Any: | ||
|
@@ -30,9 +31,7 @@ def _scrub(msg: Any) -> Any: | |
for phone in phones: | ||
msg = msg.replace(phone, "1XXXXXXXXXX") | ||
|
||
emails = re.findall( | ||
r"[\w\.-]+@[\w\.-]+", msg | ||
) # ['[email protected]', '[email protected]'] | ||
emails = _email_regex.findall(msg) | ||
for email in emails: | ||
# do something with each found email string | ||
masked_email = "XXXXX@XXXXXXX" | ||
|