擅长:python、mysql、java
<p>您需要2个正则表达式才能获得2个列表:</p>
<pre><code>import re
t1 = '''1281674 the crescent annandale 02/10/2019 16/10/2019 - 16/11/2019 pending 1281640 city west link rd lilyfield 02/10/2019 16/10/2019 - 16/11/2019 pending 1276160 victoria rd rozelle 25/09/2019 14/10/2019 - 15/10/2019 pending 1331626 31/12/2019 - 31/01/2020 incomplete n/a 1281674 the crescent annandale 02/10/2019 16/10/2019 - 16/11/2019'''
clean = re.sub(r'\b\d{7}\b(?=(?:(?!\b\d{7}\b).)*incomplete n/a).*?$', '', t1)
print clean
res = re.findall(r'(\b\d{7}\b)', clean)
print res
</code></pre>
<p><strong>输出:</strong></p>
<pre><code>1281674 the crescent annandale 02/10/2019 16/10/2019 - 16/11/2019 pending 1281640 city west link rd lilyfield 02/10/2019 16/10/2019 - 16/11/2019 pending 1276160 victoria rd rozelle 25/09/2019 14/10/2019 - 15/10/2019 pending
['1281674', '1281640', '1276160']
</code></pre>
<p><a href="https://regex101.com/r/2FdKjx/1" rel="nofollow noreferrer">Demo & explanation</a></p>