From 3ea0924120727cb3559d721bf713247090b96fd9 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Wed, 26 Apr 2017 12:41:23 +0200 Subject: [PATCH] Improved phone regex to handle end with 4 digits and presence of parenthesis. --- bin/Phone.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/Phone.py b/bin/Phone.py index b25dae41..6ad4b1b6 100755 --- a/bin/Phone.py +++ b/bin/Phone.py @@ -16,6 +16,7 @@ def search_phone(message): content = paste.get_p_content() # regex to find phone numbers, may raise many false positives (shalt thou seek optimization, upgrading is required) reg_phone = re.compile(r'(\+\d{1,4}(\(\d\))?\d?|0\d?)(\d{6,8}|([-/\. ]{1}\d{2,3}){3,4})') + reg_phone = re.compile(r'(\+\d{1,4}(\(\d\))?\d?|0\d?)(\d{6,8}|([-/\. ]{1}\(?\d{2,4}\)?){3,4})') # list of the regex results in the Paste, may be null results = reg_phone.findall(content)