Matt wrote:


Try this:
import re
my_expr = re.compile(r'(\w+) (\(\1\))')
s = "this is (is) a test"
print my_expr.sub(r'\1', s)
#prints 'this is a test'

M@


Thank you Matt. It works out well. The only think that gives it problem is in events as "there (there)", where between the word and the same bracketted word is more than one whitespaces...


Cheers
Maurice
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to