fork download
  1. import re
  2. test_string = "@@@__slug1^^__firstname lastname@@@^^^ @@@__deletepurpose^^__Delete Purpose@@@^^^"
  3. pattern = r"@@@__(.*?)\^\^__(.*?)@@@\^\^\^"
  4. matches = re.findall(pattern, test_string)
  5. print("Slug list:", [x for x,y in matches])
  6. print("Name list:", [y for x,y in matches])
Success #stdin #stdout 0.03s 9276KB
stdin
Standard input is empty
stdout
Slug list: ['slug1', 'deletepurpose']
Name list: ['firstname lastname', 'Delete Purpose']