-
Notifications
You must be signed in to change notification settings - Fork 506
Description
The underscore (_) is part of \w. From https://docs.python.org/3/library/re.html#regular-expression-syntax:
\wFor Unicode (str) patterns:
Matches Unicode word characters; this includes alphanumeric characters (as defined by str.isalnum()) as well as the underscore (_). If theASCIIflag is used, only[a-zA-Z0-9_]is matched.For 8-bit (bytes) patterns:
Matches characters considered alphanumeric in the ASCII character set; this is equivalent to[a-zA-Z0-9_]. If theLOCALEflag is used, matches characters considered alphanumeric in the current locale and the underscore.
Is there an easy way to get \w except _ in the non-ASCII case? It would help checking snake_case.
codespell/codespell_lib/_codespell.py
Line 31 in ec0a5b9
| word_regex_def = "[\\w\\-'’`]+" |