Skip to content

Commit

Permalink
Refine phone regex to avoid postal codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJaume authored Apr 26, 2022
1 parent e4921b1 commit dfccb15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion biner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# https://www.regextester.com/19
email_regex = r"(\b|^)([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)(\b|$)"
# Regular expression for phone numbers
phone_regex = r"(?!\d{4}-\d{4})[\+\-\–\(\d].[\(\)' '\+\-\–\d]{5,12}\d{2}\b"
phone_regex = r"(?![\-\–\(]?\s*\d{2,4}\s*[\-\–\s]\s*\d{3,4}\s*[\-\–\(]?)[\+\-\–\(\d].[\(\)' '\+\-\–\d]{6,12}\d{2}\b"
# Regular expressions for IP addresses
# https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
# https://www.regextester.com/25
Expand Down

0 comments on commit dfccb15

Please sign in to comment.