Letter class in re
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Mon Mar 9 07:06:42 EDT 2015
Op 09-03-15 om 11:37 schreef Wolfgang Maier:
> On 03/09/2015 11:23 AM, Antoon Pardon wrote:
>> I am using PLY for a parsing task which uses re for the lexical
>> analysis. Does anyone
>> know what regular expression to use for a sequence of letters? There is
>> a class for alphanumerics but I can't find one for just letters, which I
>> find odd.
>>
>> I am using python 3.4
>>
>
> how about [a-zA-Z] ?
>
No, that limits the characters to ASCII-letters.
This is what the doc says about the alphanumeric class:
\w
For Unicode(str) patternsL
Matches Unicode word characters; this includes most characters that
can be part
of a word in any language, as well as numbers and the underscore. If
the ASCII
flag is used, only [a-zA-Z0-9_] is matched. ...
So what I want is a class that just includes those characters that can
be part of
a word in any language.
More information about the Python-list
mailing list