fork download
  1. import re
  2. filename = "Custom-prefix_Shop_no24_20221009.csv"
  3. prefix = "Custom-prefix"
  4. pattern = re.compile(fr"{prefix}_(\w*)_(\d{{4}})(\d{{2}})(\d{{2}})\.csv")
  5. matched = pattern.search(filename)
  6. if matched:
  7. supplier, year, month, day = matched.groups()
  8. print(f'supplier={supplier}, year={year}, month={month}, day={day}')
Success #stdin #stdout 0.03s 9472KB
stdin
Standard input is empty
stdout
supplier=Shop_no24, year=2022, month=10, day=09