Regex: Matching characters, but not digits

Greg Chapman glc at well.com
Tue Nov 5 11:44:42 EST 2002


On Tue, 05 Nov 2002 16:32:07 GMT, Greg Chapman <glc at well.com> wrote:

>On Tue, 05 Nov 2002 13:06:23 +0100, Thomas Guettler
><zopestoller at thomas-guettler.de> wrote:
>
>>Hi!
>>
>>\w matches characters and digits. But,
>>how can I match only characters?
>>
>>This should work for unicode, too
>>
>>  thomas
>
>This should work: [^\W\d_].  That is, match something which is 1) not not a \w,
>2) not a digit and 3) not an underscore.
>

However, I see that under unicode [^\W\d_] includes a bunch of characters for
which isalnum is true, but isalpha is false, so Martin's suggestion really is
best.

---
Greg Chapman




More information about the Python-list mailing list