import re
match=re.search(r'[1-9]\d{5}','BIT 100081')
if match:
print(match.group(0))
100081
type(match)
<class 're.Match'>
import re
m=re.search(r'[1-9]\d{5}',"BIT100081 TSU100084")
m.string
'BIT100081 TSU100084'
m.re
re.compile('[1-9]\\d{5}')
m.pos
0
m.endpos
19
m.group(0)
'100081'
m.start()
3
m.end()
9
m.span()
(3, 9)
match = re.search(r'PY.*N', 'PYANBNCNDN')
match.group(0)
'PYANBNCNDN'
match = re.search(r'PY.*?N', 'PYANBNCNDN')
match.group(0)
'PYAN'