Bobby Xiao <nneonneo at gmail.com> added the comment: How would I apply that workaround to my example? re.sub("foo(?:b(ar)|baz)","\\1","foobaz") _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue1519638> _______________________________________