Matthew Barnett <pyt...@mrabarnett.plus.com> added the comment: The replacement can be a callable, so you could do this:
re.sub(r'(?:\((?:(\d+)|.*?)\)\s*)+$', lambda m: m.group(1) or '', 'avatar (special edition)') ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1519638> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com