Hi, In: https://docs.python.org/3/library/re.html#regular-expression-syntax at: \WMatches any character which is not a word character. This is the opposite of \w. If the ASCII https://docs.python.org/3/library/re.html#re.ASCII flag is used this becomes the equivalent of [^a-zA-Z0-9_] (but the flag affects the entire regular expression, so in such cases using an explicit [^a-zA-Z0-9_] may be a better choice). If the LOCALE https://docs.python.org/3/library/re.html#re.LOCALE flag is used, matches characters considered alphanumeric in the current locale and the underscore. shouldn't it be instead: \WMatches any character which is not a word character. This is the opposite of \w. If the ASCII https://docs.python.org/3/library/re.html#re.ASCII flag is used this becomes the equivalent of [^a-zA-Z0-9_] (but the flag affects the entire regular expression, so in such cases using an explicit [^a-zA-Z0-9_] may be a better choice). If the LOCALE https://docs.python.org/3/library/re.html#re.LOCALE flag is used, matches characters not considered alphanumeric in the current locale and the underscore. ? Thanks. Gilles. *---* *Expect the best, plan for the worst, and prepare to be surprised. * (Espère le meilleur, prépare-toi pour le pire & attends-toi à être surpris.) *Denis Waitley*
participants (1)
-
Gilles Feyrit