New submission from muxum <mxgn...@gmx.de>: #download/try this: http://ideone.com/QA6Fg
from re import * s = 'a->b\na->b\nc->b\nc->b\na->d\na->d\ne->b\ne->b\na->f\na->f\ng->b\ng->b\na->h\na->h\ni->b\ni->b\na->j\na->j\nk->b\nk->b\n' res = subn(r"(.*\n)(\1)+",r"replaced:\1",s,M) print("output: " + res[0]) print("replace count: %d" % res[1]) # if it works right the next print wont show if res[1] == 8: print("WEIRD: too few replacements ("+str(res[1])+")") #i'd expect this to replace all ocurrences not only the first 8 times ---------- components: Regular Expressions messages: 128422 nosy: muxum priority: normal severity: normal status: open title: re sub subn backreferrence too few replacements type: behavior versions: Python 2.6, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11198> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com