fork download
  1. import re
  2. text="name of company.\nlastname, firstname - 12345\nDates of Service Diag Xref Proc Code Voucher POS/TOS Units Provider Al/As Other Plan Bill Amt Receipts Net"
  3. Re_text = re.compile(r'([A-Za-z]+)(?:,\s+([A-Za-z]+))?,\s+([A-Za-z]+)\s+-\s+(\d+)$', re.M)
  4. m = Re_text.search(text)
  5. if m:
  6. print(m.group(1))
  7. print(m.group(2))
  8. print(m.group(3))
  9. print(m.group(4))
Success #stdin #stdout 0.03s 9516KB
stdin
Standard input is empty
stdout
lastname
None
firstname
12345