Considering the hypothesis of text (with and without paragraph separation - for each group whose content repeats itself):
ball, spring, brick, pierre, ball, spring, brick, raimundo, ball, spring, brick, joao, ball, spring, brick, felipe, ball, spring, brick, ball, spring, brick, pebble, ball, spring, brick, raimundo, ball, spring, brick, joao, ball, spring, brick, felipe, ball, spring, brick.group2 ,
group3 tiago ball spring brick brickwork ball spring brick raimundo ball spring brick joao ball spring brick brick ball brick spring brick ,
group4 tiago ball spring brick brick ball spring spring brick raimundo ball spring brick joao ball spring brick brick ball spring spring brick ,
ball, spring, brick, pebble, ball, spring, brick, raimundo, ball, spring, brick, joao, ball, spring, brick, felipe, ball, spring, brick.group5 ,
Using regex ( PHP
) how to limit the search to what is between group3 and group4 so that my output is in subgroups of people:
tiago ball spring brick
pedro ball spring brick
raimundo ball spring brick
Joao Ball Spring Brick
Felipe Ball Spring Brick