def extract_substring_positions(text, substr)
      positions = []
      scanner = StringScanner.new(text)
      positions << scanner.pos while scanner.scan(/(.*?)#{substr}/)
      positions
    end
def extract_substring_positions(text, substr)
      positions = []
      scanner = StringScanner.new(text)
      positions << scanner.pos while scanner.scan(/(.*?)#{substr}/)
      positions
    end
Returns indexes of all occurrences of a substring within a string.

 Note, this will not return overlaping substrings, so searching for "aa"
 in "aaa" will only find one substring, not two.

 @param text [String] the text to search
 @param substr [String] the substring to search for
 @return [Array<Integer>] list of indexes where the substring occurs