[issue27116] Documentation for regular expression alphanumeric matching are swapped. https://docs.python.org/2/library/re.html#regular-expression-syntax
New submission from dananntang: https://docs.python.org/2/library/re.html#regular-expression-syntax Section 7.2.1. Regular Expression Syntax Documentation for \w and \W are wrong. To be specific: \w is to match any non-alphanumeric character, while \W is to match alphanumeric character Fix: swap documentation for \w and \W ---------- assignee: docs@python components: Documentation messages: 266291 nosy: dananntang, docs@python priority: normal severity: normal status: open title: Documentation for regular expression alphanumeric matching are swapped. https://docs.python.org/2/library/re.html#regular-expression-syntax versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27116> _______________________________________
Xiang Zhang added the comment: I don't think no need to swap. The current doc is right.
re.findall(r'\W+', 'abcd123_#@@@@') ['#@@@@'] re.findall(r'\w+', 'abcd123_#@@@@') ['abcd123_']
It's apparent that \w match alphanumeric and \W vice versa. ---------- nosy: +xiang.zhang _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27116> _______________________________________
Changes by Zachary Ware <zachary.ware@gmail.com>: ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27116> _______________________________________
participants (3)
-
dananntang
-
Xiang Zhang
-
Zachary Ware