Improved phone regex to handle end with 4 digits and presence of parenthesis.

pull/128/head
Mokaddem 2017-04-26 12:41:23 +02:00
parent b60e164380
commit 3ea0924120
1 changed files with 1 additions and 0 deletions

View File

@ -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)