Strange regex problem

Miki Tebeka tebeka at cs.bgu.ac.il
Sun Mar 2 03:48:39 EST 2003


Hello Dagur,

> 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

1. Which version of Python are you using?
2. Can you give us a sample input file?

10x.
Miki




More information about the Python-list mailing list