New submission from Owen <owentrigue...@gmail.com>: "\W" regex pattern, when used with `re.ASCII`, is expected to have the same behavior as "[^a-zA-Z0-9_]" (see [1]).
For example, the following `sub()` call ``` >>> re.sub('\W', '', '½ a', re.ASCII) '½a' ``` should return the same as this one: ``` >>> re.sub('[^a-zA-Z0-9_]', '', '½ a', re.ASCII) 'a' ``` But it does not. [1] https://docs.python.org/3/library/re.html#regular-expression-syntax ---------- components: Regular Expressions messages: 403810 nosy: ezio.melotti, mrabarnett, owentrigueros priority: normal severity: normal status: open title: "\W" pattern with re.ASCII flag is not equivalent to "[^a-zA-Z0-9_]" type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45458> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com