ungreedy regular expressions
Constantinos A. Kotsokalis
ckotso at cs.ntua.gr
Wed Apr 26 07:39:00 EDT 2000
Disclaimer: I am not sure whether this has been brought up before,
I am not reading the newsgroup very often (I could not find any reference
though, after a subject search).
I recently added two lines of code to the python distribution, in order
to support ungreedy regular expressions (which are supported by pcre
but I could find no way to use them in python code). If there is some
way already that I am not aware of, please e-mail me :-) If you are
interested in having it available, edit Modules/pcremodule.c and add
the line:
insint(d, "UNGREEDY", PCRE_UNGREEDY);
after line 681. Then compile and install python, and right after
edit <python-prefix>/lib/python1.5/re.py, and add the line:
U = UNGREEDY
after line 18.
That's all, you can now use re.UNGREEDY (or re.U) just like re.MULTILINE
etc.
Regards,
Costas
--
fsck your brains
More information about the Python-list
mailing list