fork download
  1. import re as r
  2. from datetime import datetime
  3. text = 'Cont:7225811153; BillNo4896TableNoR306 07-Jun-201921:18:40'
  4. id = r.search(r'\d{2}-\w{3}-\d{4}',text)
  5. if id:
  6. print(datetime.strptime(id.group(),'%d-%b-%Y').date())
  7.  
Success #stdin #stdout 0.04s 11164KB
stdin
Standard input is empty
stdout
2019-06-07