That's way more complicated than what you had before.
Code:
Find the first one
Find the second one
while (second one != npos)
  first one += 1 (to get rid of the slash)
  target = substr(first one, second one)
  first one = second one
  second one = find again, starting from second one+1
end while