Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2049 -- Made isValidEmail validator wider in scope. Thanks, mi…

…r@noris.de

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3026 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1bf991abb32c3fab1a1d81d3087d7f6e16a54559 1 parent 2543d0a
Adrian Holovaty authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  django/core/validators.py
5  django/core/validators.py
@@ -20,7 +20,10 @@
20 20
 ansi_date_re = re.compile('^%s$' % _datere)
21 21
 ansi_time_re = re.compile('^%s$' % _timere)
22 22
 ansi_datetime_re = re.compile('^%s %s$' % (_datere, _timere))
23  
-email_re = re.compile(r'^[A-Z0-9._%-][+A-Z0-9._%-]*@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$', re.IGNORECASE)
  23
+email_re = re.compile(
  24
+    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"  # dot-atom
  25
+    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
  26
+    r')@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$', re.IGNORECASE)  # domain
24 27
 integer_re = re.compile(r'^-?\d+$')
25 28
 ip4_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$')
26 29
 phone_re = re.compile(r'^[A-PR-Y0-9]{3}-[A-PR-Y0-9]{3}-[A-PR-Y0-9]{4}$', re.IGNORECASE)

0 notes on commit 1bf991a

Please sign in to comment.
Something went wrong with that request. Please try again.