code: def find_word_groups(string, words):
      
      scale_pattern = '|'.join(words)
      # For example:
      # (?:(?:\d+)\s+(?:hundred|thousand)*\s*)+(?:\d+|hundred|thousand)+
      regex = re.compile(
          r'(?:(?:\d+)\s+(?:' +
          scale_pattern +
          r')*\s*)+(?:\d+|' +
          scale_pattern + r')+'
      )
      result = regex.findall(string)
      return result
docs: Find matches for words in the format "3 thousand 6 hundred 2".
      The words parameter should be the list of words to check for
      such as "hundred".