Letter class in re
Albert-Jan Roskam
fomcl at yahoo.com
Tue Mar 10 04:46:12 EDT 2015
On Tue, 3/10/15, Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
Subject: Re: Letter class in re
To: python-list at python.org
Date: Tuesday, March 10, 2015, 9:35 AM
Op 09-03-15 om 17:11
schreef Steven D'Aprano:
> 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
>
> The re
module in Python is pretty old and basic. Can you use
Matthew
> Barnett's regex module,
available on PyPI? I understand it has a richer set
> of flags for things such as Unicode
letters and the like.
Not
really. I could use regex to build a lexer but that would
mean having to do
a lot of extra work, since
I couldn't use the abstraction that is offered by
PLY.lex.
PLY.yacc allows the use of a
different lexer but PLY.lex doesn't allow the use
of a different regular expression engine.
--> Perhaps you could use/abuse Pygments? http://pygments.org/docs/lexerdevelopment/
More information about the Python-list
mailing list