Python Parse regex
- by Nemo
Let's say I have string in the form given below:
myString={"name", "age", "address", "contacts", "Email"}
I need to get all the items of myString into a List using python. Here's what I did
r= re.search("myString=\{\"(.+)\", $\}", line)
if r:
items.append(r.group(1))
print(items)
Here line is the variable that holds the content of my text file.
What change do I have to make to my regex to get all the items in myString? Please kindly help me out. Thanks.