Skip to content

Instantly share code, notes, and snippets.

@afr-dt
Created January 8, 2021 20:01
Show Gist options
  • Save afr-dt/93f7ba432f50e7fa2fc4da3ceba09738 to your computer and use it in GitHub Desktop.
Save afr-dt/93f7ba432f50e7fa2fc4da3ceba09738 to your computer and use it in GitHub Desktop.
Validate phone with + symbol
import re
def validate_phone(phone):
if re.match(r'^\+1?\d{9,15}$', phone):
print(f'{phone} is valid number')
else:
print(f'{phone} is not valid')
validate_phone('+52558397')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment