import re m = re.search(r'[1-9]d{5}', 'jgjh 1000815k55551555') # raw string, 原生字符串 if m: print(m) print(m.group(0)) print(m.group())