Get the index for each occurrence of a string.