code: function attemptReplacePatterns(token, replacements, measureThreshold) {
    var replacement = null;
  
    for(var i = 0; i < replacements.length; i++) {
      if(!measureThreshold || measure(attemptReplace(token, replacements[i][0], '')) > measureThreshold)
        replacement = attemptReplace(token, replacements[i][0], replacements[i][1]);
  
      if(replacement)
        break;
    }
  
    return replacement;
  }
docs: Attempt to replace a list of patterns/replacements on a token for a minimum measure M.