Lad wrote: > Peter, > I tried exactly this > ######## > import re > Results=[] > data1='<a href="detailaspxmember=15015&mode=advert" </a><a > href="detailaspxmember=15016&mode=advert" </a><a > href="detailaspxmember=15017&mode=advert" </a>' > ID = re.compile(r'^.*=(\d+)&.*$',re.MULTILINE) > Results=re.findall(ID,data1) > print "Results are= ",Results > ######### > and received > Results are= ['15017'] > > Not all numbers > > What exactly did you get?
With /exactly/ this, I get: $ cat lad1.py import re Results=[] data1='<a href="detailaspxmember=15015&mode=advert" </a><a href="detailaspxmember=15016&mode=advert" </a><a href="detailaspxmember=15017&mode=advert" </a>' ID = re.compile(r'^.*=(\d+)&.*$',re.MULTILINE) Results=re.findall(ID,data1) print "Results are= ",Results $ python lad1.py File "lad1.py", line 3 data1='<a href="detailaspxmember=15015&mode=advert" </a><a ^ SyntaxError: EOL while scanning single-quoted string When I modify it to compile, I get /exactly/ this: $ cat lad2.py import re Results=[] data1='''<a href="detailaspxmember=15015&mode=advert" </a><a href="detailaspxmember=15016&mode=advert" </a><a href="detailaspxmember=15017&mode=advert" </a>''' ID = re.compile(r'^.*=(\d+)&.*$',re.MULTILINE) Results=re.findall(ID,data1) print "Results are= ",Results $ python lad2.py Results are= ['15015', '15016', '15017'] Peter -- http://mail.python.org/mailman/listinfo/python-list