I need to replace the square brackets for curly brackets and the underscores for spaces.
Input:
[something_id='123'_more-info='321']
Output so far:
{something_id='123'_more-info='321'}
Required Output:
{something id='123' more-info='321'}
I can replace the brackets but I don't know where to start with searching within the capturing group to replace the spaces. I'm not even sure what terms I should be searching the web for to try to find the answer.
search = re.compile(r"\[(something.*)\]")
return search.sub(r"{\1}", text_source)