I have this set (number of points variable, here 2):
A
This is some Text belonging to A
This also belongs to A
B
This should be with B
same with this
...
...
I want it to finally be a string like that:
A This is some Text belonging to A This also belongs to A
B This should be with B same with this
My try was something like:
answer.scan(/^([A-Z].+?(?=^[A-Z]))/m).map { |d| d.delete("\n") }.join("\n")
The problem is that this doesn't match the last set (you can assume the string ends with the last set) any ideas? :)
edit1: fixed a coyping error & tried a new regex in Rubular which kind of works but still has some unnecessary matches?