Message141430
| 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.4902309e-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. |
|