mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-31 14:36:15 +00:00
Improved phone regex to handle end with 4 digits and presence of parenthesis.
This commit is contained in:
parent
b60e164380
commit
3ea0924120
1 changed files with 1 additions and 0 deletions
|
@ -16,6 +16,7 @@ def search_phone(message):
|
||||||
content = paste.get_p_content()
|
content = paste.get_p_content()
|
||||||
# regex to find phone numbers, may raise many false positives (shalt thou seek optimization, upgrading is required)
|
# 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,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
|
# list of the regex results in the Paste, may be null
|
||||||
results = reg_phone.findall(content)
|
results = reg_phone.findall(content)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue