Emacs-style regex?

Mats Svensson (euamsn@eua.ericsson.se)
18 Aug 1994 16:37:14 GMT

Does python's regex module support the \n feature,
where \n refers to the nth '\(\)' group?

If so, what must I do to make the script below work?

% cat regtest.py

import sys, regex

# This should match e.g. xxx___xxx:
pat = regex.compile('\(xxx\)\(.*\)\1')

if pat.search(sys.argv[1]) != -1:
print pat.group(1), pat.group(2)
else:
print 'No match?'

% python regtest.py 'xxx___xxx'
No match?

Mats Svensson