#28628: Audit for and abolish all use of '\d' in regexes
--------------------------------------+------------------------------------
     Reporter:  James Bennett         |                    Owner:  JunyiJ
         Type:  Cleanup/optimization  |                   Status:  assigned
    Component:  Documentation         |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by JunyiJ):

 Based on [https://docs.python.org/3/library/re.html]:\\
 \\
 \d
 For Unicode (str) patterns:\\

 Matches any Unicode decimal digit (that is, any character in Unicode
 character category [Nd]). This includes [0-9], and also many other digit
 characters. If the ASCII flag is used only [0-9] is matched (but the flag
 affects the entire regular expression, so in such cases using an explicit
 [0-9] may be a better choice).\\
 \\
 I think using [0-9] may be better than ASCII. Correct me if I am wrong.
 \\

 Replying to [comment:7 Sergey Fedoseev]:
 > I'm not sure if this change should be done for `bytes`, also the usage
 of [https://docs.python.org/3/library/re.html#re.ASCII] flag could be
 better alternative to explicit `[0-9]`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28628#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.6c3869dcff8a322144eb7be4284800f3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to