If you know that, for instance, every occurrence of '[[' needs to be replaced with ']]', then it is much faster to use regular string methods. If you have the text stored in the variable foo:
foo = foo.replace('[[', '[').replace(']]', ']').replace('->', '') If you need to recognize the actual pattern, use REs: regex = re.compile(r'\[\[(.+?) -> (.+?)\]\]') regex.sub(r'[\1 \2]', foo) -- http://mail.python.org/mailman/listinfo/python-list