I have a huge text file that has information stored in this format.
someOtherMessage{
class = "someClass";
sampleMessage{
someValue{
someText{
someParam = "value";
someSymbol = "another_symbol";
}; //someText
}; //someValue
}; //sampleMessage
}; //someOtherMessage
someOtherMessage2{
class = "someClass2";
sampleMessage2{
someValue2{
someText2{
someParam = "value2";
someSymbol = "another_symbol2";
}; //someText2
}; //someValue2
}; //sampleMessage2
}; //someOtherMessage2
I want to iterate over this file using a py script and build a dict(or any other data struct) in the following format.
For eg.
dict = {'someOtherMessage': 'someOtherMessage{
class = "someClass";
sampleMessage{
someValue{
someText{
someParam = "value";
someSymbol = "another_symbol";
}; //someText
}; //someValue
}; //sampleMessage
}; //someOtherMessage',
'someOtherMessage2': 'someOtherMessage2{
class = "someClass2";
sampleMessage2{
someValue2{
someText2{
someParam = "value2";
someSymbol = "another_symbol2";
}; //someText2
}; //someValue2
}; //sampleMessage2
}; //someOtherMessage2'
}
I used the following regex but it picks everything between the first and last curly brace, how can I make it pick just the required ones separately?