Extracting multiple values from a string using regex or string methods [duplicate]

let string = "value1/value2/value3"

I need a function that extracts all data between forward slashes in order. One problem is that we don’t know how long the string would be and therefore how many pieces of data we need to get.