The reconvert Module
(Obsolete) The reconvert
module, shown in Example 14-34, converts old-style regular expressions as
used by the regex
module to the new style
used by the re
module. It can also be used as a command-line tool.
Example 14-34. Using the reconvert Module
File: reconvert-example-1.py import reconvert for pattern in "abcd", "a\(b*c\)d", "\<\w+\>": print pattern, "=>", reconvert.convert(pattern)abcd => abcd
a\(b*c\)d => a(b*c)d
\<\w+\> => \b\w+\b
Get Python Standard Library now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.