I'm starting in programming and I'm looking to make a program for extracting all the words contained between two words within a text (in order store them in a variable )

For example with the words "START" & "STOP":
"START 1 2 3 STOP 5 6 START 7 8 STOP 9 10"

I would like to store in variables: 1 2 3 7 8

I started to do it with Ruby as you can see in the code below, my current idea was to convert the string "global" into an array and then number the position of string1 and string2; then create an array ‘string1’ with the values of the initial array # string1 + 1,… string2 -1. 
Unfortunately, it works only once because the .index function only works on the first occurence...would there be a better way to do that ?

Thank you in advance for your help

```
text = "0 start 2 3 4 stop 6 7 start 9 10 stop 12"

start= text.split(' ')

a = start.index('start')
b = start.index('stop')

puts a
puts b
puts c = start[a+1,b-a-1].join(" ")

# returns 
#1
#5
#2 3 4 ```

```