1

I'm new to python. I have a long string that has several numbers in it. I only need the numbers that matches the XX XX XXXXXX form (ex. 15 09 066456). Any help is appreciated.

xrtxn
  • 35
  • 8

1 Answers1

2

I'm not allowed to comment, so posting the possible solution(using regex) here, python 3.x

import re
text='15 09 066456'
pattern = r'\d{2}\s\d{2}\s\d{6}'
match= re.findall(pattern,text)
print(match)
Abhinav Mathur
  • 7,791
  • 3
  • 10
  • 24