Author ezio.melotti
Recipients anacrolix, brandon-rhodes, eric.araujo, eric.smith, ezio.melotti, georg.brandl, python-dev, r.david.murray, vstinner, xuanji
Date 2011-07-30.07:20:16
SpamBayes Score 1.49023e-06
Marked as misclassified No
Message-id <1312010417.59.0.384316359522.issue9723@psf.upfronthosting.co.za>
In-reply-to
Content
+_find_unsafe = re.compile(r'[^\w\d@%_\-\+=:,\./]').search

\w already includes both \d and _, so (unless you really want to be explicit about it) they are redundant.  Also keep in mind that they match non-ASCII letters/numbers on Python 3.
'+' and '.' don't need to be escaped in a character class (i.e. [...]), because they lose their meta-characters meaning there.
'-' is correctly escaped there, but it's common practice to place it at the end of the character class, where it doesn't need escaping.

r'[^\w\d@%_\-\+=:,\./]' and r'[^\w@%+=:,./-]' should therefore be equivalent.
History
Date User Action Args
2011-07-30 07:20:17ezio.melottisetrecipients: + ezio.melotti, georg.brandl, vstinner, eric.smith, eric.araujo, r.david.murray, brandon-rhodes, anacrolix, xuanji, python-dev
2011-07-30 07:20:17ezio.melottisetmessageid: <1312010417.59.0.384316359522.issue9723@psf.upfronthosting.co.za>
2011-07-30 07:20:17ezio.melottilinkissue9723 messages
2011-07-30 07:20:16ezio.melotticreate