fork(1) download
  1. import re
  2. line ="[u'INVOICE# SMR/0038 f\"', u'', u'', u'']"
  3. pattern = re.compile('invoice#\s+([A-Za-z]{3}/\d{1,5})', re.I)
  4. print( re.findall(pattern, line) )
  5. # get the first match
  6. m = pattern.search(line)
  7. if m:
  8. print(m.group(1))
Success #stdin #stdout 0.01s 7268KB
stdin
Standard input is empty
stdout
['SMR/0038']
SMR/0038