The reconvert module

This module 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: 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
 

[comment on/vote for this article]

A Django site. this page was rendered by a django application in 0.02s 2008-10-13 00:11:59.974430. hosted by webfaction.