aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/edify/library/phone.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/edify/library/phone.py b/src/edify/library/phone.py
index 90ab535..362fa97 100644
--- a/src/edify/library/phone.py
+++ b/src/edify/library/phone.py
@@ -1,6 +1,7 @@
import re
pattern = "^\\+?\\d{1,4}?[-.\\s]?\\(?\\d{1,3}?\\)?[-.\\s]?\\d{1,4}[-.\\s]?\\d{1,4}[-.\\s]?\\d{1,9}$"
+special_pattern = r"^\d{2,4}"
def phone_number(phone: str) -> bool:
@@ -12,7 +13,7 @@ def phone_number(phone: str) -> bool:
bool: True if the string is a valid phone number, False otherwise.
"""
- if re.match(pattern, phone):
+ if re.match(pattern, phone) or re.match(special_pattern, phone):
return True
else:
return False