Reputation: 63
Hello I have a problem with parsing this text
{
{
{
{[system1];1;1;0.612509325};
{[system2];1;1;0.977659115};
{[system3];1;1;36.97828732969};
{[system4];1;1;61.43154423}
};2.5469
};
{
{
{[system5];1;1;0.9613443};
{[system6];1;1;2.06340392};
{[system7];1;1;4.12680784};
{[system8];1;1;6.18989626};
{[system9];1;1;24.75958504758};
{[system10];1;3;61.8989626189}
};31.6952
}
}
I need to parse it into an object like this
class Group
{
Rate = 31.6952
Systems =
{
System5 = {[system5];1;1;0.9613443};
System6 ={[system6];1;1;2.06340392};
System7 ={[system7];1;1;4.12680784};
System8 ={[system8];1;1;6.18989626};
System9 ={[system9];1;1;24.75958504758};
System10 ={[system10];1;3;61.8989626189}
}
}
I tried
({[^{}]})
but it doesn't group it well.
Upvotes: 4
Views: 99
Reputation: 114
try this regex
{[\d\w]*.*?}
It will return
{[system5];1;1;0.9613443}
From
System5 = {[system5];1;1;0.9613443};
Upvotes: 1