a = """abcda"sd"asd["first", "last", "middle", "dob", "gender"]abcda"sd"asd"""
a = re.sub("\[(\".*?\",?)*\]", r'\g<0>'.replace('"', ""), a)
print(a)
I am trying to replace the double qoutations in the provided string. Is the method i am using correct?
Is there another method (one-liner preferred) to obtain the desired result.
Desired string result as below
"""abcda"sd"asd['first', 'last', 'middle', 'dob', 'gender']abcda"sd"asd"""
I need to replace double quotes only inside the square brackets []