In PEP 0263, the format for determining the encoding of a Python file is defined as:
coding[:=]\s*([-\w.]+)
Why does it exist .in regular expression, or, alternatively, why does it exist -and \w? As far as I understand, it .matches any character except a newline, so either [-\w]or [.]will correspond to legal names consisting of alphanumeric characters and dashes .
What is the reason that both -\wand .are listed together [-\w.]?
source
share