code: def _makeDynamicSubsctitutions(string, contextData):
          
          def _replaceFunc(escapeMatchObject):
              stringIndex = escapeMatchObject.group(0)[1]
              index = int(stringIndex)
              if index < len(contextData):
                  return contextData[index]
              else:
                  return escapeMatchObject.group(0)  # no any replacements, return original value
  
          return _numSeqReplacer.sub(_replaceFunc, string)
docs: For dynamic rules, replace %d patterns with actual strings
          Python function, which is used by C extension.