Skip to content

Instantly share code, notes, and snippets.

@RaidoS
Created June 21, 2017 12:16
Show Gist options
  • Save RaidoS/cdfb01da7dc815f7b178a046902e333b to your computer and use it in GitHub Desktop.
Save RaidoS/cdfb01da7dc815f7b178a046902e333b to your computer and use it in GitHub Desktop.
python / django regexp
# python / django regexp for phone validating
# regexp
r'^\+?1?\d{9,15}$'
# django validator
from django.core.validators import RegexValidator
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message=u'Phone number must be like: +79999999999')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment