How to regularly match all data of a specified length at the beginning of a specified number? (including the number itself)

for example, extract all the seven digits at the beginning of 131 on this page without repeating

<a href="/1310280" title="1310280">1310280</a></li><li><a href="/1310281" title="1310281">1310281</a></li><li><a href="/1310282" title="1310282">1310282</a></li><li><a href="/1310283" title="1310283">1310283</a></li><li><a href="/1310284" title="1310284">1310284</a></li><li><a href="/1310285" title="1310285">1310285</a></li><li><a href="/1310286" title="1310286">1310286</a></li><li><a href="/1310287" title="1310287">1310287</a></li><li><a href="/1310288" title="1310288">1310288</a>

import re
re.findall (r "131d {4}", "matching string")
the return value is an array, just click on the same data on Filter.


depressed, solved by myself

re.compile(r'%s+?\d{4}(?=">)'%())
Menu