re module help

Daniel Dittmar daniel.dittmar at sap.corp
Fri Sep 9 12:31:12 EDT 2005


rattan at cps.cmich.edu wrote:
> if I start replacing regex by re I get stuck at replacement of
>    regex.symcomp() and regex.pattern()

Groups identified by names are part of the standard regular expression 
syntax:
regex.symcomp ('\(<id>[a-z][a-z0-9]*\)')
becomes
re.compile ('(?Pid[a-z][a-z0-9]*)')

I get AttributeError for both regex.pattern and regex.compile 
('abc').pattern.

re compiled regular expression have a pattern attribute, this was named 
givenpat and realpat in the regex module.

Daniel



More information about the Python-list mailing list