--- On Wed, 12/16/09, Peter Otten <__pete...@web.de> wrote: > Another possibility: > > >>> print re.sub('abc', lambda m: r'a\nb\n.c\a', > '123abcdefg') > 123a\nb\n.c\adefg
I'm not sure whether that is clever, ugly, or just plain strange! I think I'll stick with: >>> m = re.match('^(.*)abc(.*)$', '123abcdefg') >>> print m.group(1) + r'a\nb\n.c\a' + m.group(2) 123a\nb\n.c\adefg It's much less likely to fry the poor maintenance programmer's mind. -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list