[issue38566] Description of '\w' behavior is vague in `re` documentation

James Gerity report at bugs.python.org
Wed Oct 23 15:25:34 EDT 2019


James Gerity <snoopjedi at gmail.com> added the comment:

Cheers for the additional context. My recommendation would be to change the language to avoid confusion with the consortium's formal specifications. Describing what SRE does should be fine:

> Matches any alphanumeric Unicode character, as well as '_'. If the ASCII flag is used, only [a-zA-Z0-9_] is matched.

I think it'd also be nice for the term "alphanumeric Unicode character" to link to the documentation for `str.isalnum()`, which provides enough clarity for the user to work out exactly what Unicode category properties will end up qualifying as a match.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38566>
_______________________________________


More information about the Python-bugs-list mailing list