I have the following string (file):
s = '''
\newcommand{\commandName1}{This is first command}
\newcommand{\commandName2}{This is second command with {} brackets inside
in multiple lines {} {}
}
\newcommand{\commandName3}{This is third, last command}
'''
Now I would like to use Python re package to extract the data to dictionary where key is the command name (\commandName1, \commandName2 and \commandName3) and the values are the This is first command, This is second command with {} brackets inside in multiple lines {} {} and This is third, last command. I tried sth like:
re.findall(r'\\newcommand{(.+)}{(.+)}', s)
but it doesnt work because second command has {} inside. What is the easiest way to do that?