My string is:
test_string = "@@@__slug1^^__firstname lastname@@@^^^ @@@__slug2^^__firstname1 lastname1@@@^^^"
I am trying to separate slug and lastname in a list my output will be like.
slug_list = [slug1,slug2]
name_list=[firstname lastname,firstname1 lastname1]
I try to first search all the slug my code for the same is.
import re
test_string = "@@@__slug1^^__firstname lastname@@@^^^ @@@__deletepurpose^^__Delete Purpose@@@^^^"
pattern = "@@@__\|(''*?)\|^^"
substring = re.search(pattern, test_string).group(1)
print(substring)
But it does not find a match as it is giving me the AttributeError: 'NoneType' object has no attribute 'group' error.
What is wrong with the pattern I am using?