'Format string based on word match

I ran out of ideas. I need to format this text creating a paragraph for each instance of the word 'Group'.

Notice Group1, Group2:

('uniqueName', 'Group', True ),
('Value', 'float', 0, 5, 1 ),
('Value', 'int', 1 ),
('Value', 'bool', true),
('uniqueName', 'Group', True ),
('Value', 'bool', true),
....

I need to separate this is in two paragraphs:

('uniqueName', 'Group', True ),
('Value', 'float', 0, 5, 1 ),
('Value', 'int', 1 ),
('Value', 'bool', true),

('uniqueName', 'Group', True ),
('Value', 'bool', true),

Each group represents the parameters below it, so Group1 have value1 - value3. The groups and values share the same pattern so is being difficult. I'm using QT with QString.



Solution 1:[1]

Thanks to Aconcagua's comment I found a solution. Just had to check for each Group match and add a new line before copying the line to the file. Then check for everything that was not a group and add it to the file after adding the group:

If(Group)
{ // add a blank line
  // Copy the group to the file
}

if(!Group)
{
  // Copy the line to the file
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tac