code: function applyReplacements(regionProvider, s, replacementsProp) {
    if (!defined(s)) {
      return undefined;
    }
    var r;
    if (typeof s === "number") {
      r = String(s);
    } else {
      r = s.toLowerCase().trim();
    }
    var replacements = regionProvider[replacementsProp];
    if (replacements === undefined || replacements.length === 0) {
      return r;
    }
  
    if (regionProvider._appliedReplacements[replacementsProp][r] !== undefined) {
      return regionProvider._appliedReplacements[replacementsProp][r];
    }
  
    replacements.forEach(function(rep) {
      r = r.replace(rep[2], rep[1]);
    });
    regionProvider._appliedReplacements[replacementsProp][s] = r;
    return r;
  }
docs: Apply an array of regular expression replacements to a string. Also caches the applied replacements in regionProvider._appliedReplacements.
  @private
  @param {RegionProvider} regionProvider The RegionProvider instance.
  @param {String} s The string.
  @param {String} replacementsProp Name of a property containing [ [ regex, replacement], ... ], where replacement is a string which can contain '$1' etc.