re module help

R

rattan

I am trying to make prescript-2.2 (old python based psotscript to plain
text converter).
It gives the following dprecation message

/local/users/ishwar/prescript-2.2/misc.py:23: DeprecationWarning: the
regex module is deprecated; please use the re module
import os, regex, sys, string

if I start replacing regex by re I get stuck at replacement of
regex.symcomp() and regex.pattern()

methods. The are not in re module.

Is there a solution?
-ishwar
 
D

Daniel Dittmar

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
 
S

Steve Holden

I am trying to make prescript-2.2 (old python based psotscript to plain
text converter).
It gives the following dprecation message

/local/users/ishwar/prescript-2.2/misc.py:23: DeprecationWarning: the
regex module is deprecated; please use the re module
import os, regex, sys, string

if I start replacing regex by re I get stuck at replacement of
regex.symcomp() and regex.pattern()

methods. The are not in re module.

Is there a solution?
-ishwar

This may or may not help:

http://web.archive.org/web/20001119074200/www.python.org/doc/howto/regex-to-re/regex-to-re.html

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,315
Members
48,001
Latest member
Wesley9486

Latest Threads

Top