fork download
  1. import re
  2. texts = ['20220213-0000-FSC-814-SC_VIRG_REFBAL_PRES_NPMINMAX-v1.xml',
  3. '20220213-0000-F814-SC_VIRG_REFBAL_PRES_NPMINMAX-v1.xml']
  4. pattern = r'F(?:SC)?-?(\d{3})'
  5. for text in texts:
  6. match = re.search(pattern, text)
  7. if match:
  8. print (match.group(1))
  9.  
  10.  
Success #stdin #stdout 0.03s 9592KB
stdin
Standard input is empty
stdout
814
814