I need to make 3 groups out of the following text:
[startA]
this is the first group
[startB]
blabla
[end]
[end]
[startA]
this is the second group
[startB]
blabla
[end]
[end]
[startA]
this is the second group
[startB]
blabla
[end]
[end]
As you can see, each group begins with [startA] and ends with [end], it should be easy to make a regex that matches this.
But the problem is that inside a group, the string [end] is used an arbitrary amount of times.
The regex should match a group that starts with [startA] and ends with the [end] right before the next [startA], not a previous [end].
I think it should be done with lookahead but none of my attempts have worked so far.
Is it possible to do this with a regex?