Ezio Melotti <ezio.melo...@gmail.com> added the comment:

+_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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9723>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to