Strange regex problem

Dagur Páll Ammendrup dagurp at heimsnet.is
Sat Mar 1 23:11:45 CET 2003


Hi,

I have this code:

     p = re.compile('<!--START:(\w*?)-->')
     m = p.search(file)
     while m:
         begin = m.end()
         match = m.group(1)
         n = re.search('<!--END:%s-->' % match,file,begin)
         locations.append((match,begin,n.start()))
         m = p.search(file,begin)

It works and everything but when I run it I get a long list of

literal 45
literal 73
literal 66
literal 70
literal 95
literal 71
[...]

printed out. What causes this??

-Dagur





More information about the Python-list mailing list