<commit_before>module.exports = {
  setNewValue,
};

function setNewValue(currentFileContent, upgrade) {
  try {
    logger.debug(`setNewValue: ${upgrade.newFrom}`);
    const oldLine = new RegExp(
      `(^|\n)${upgrade.fromPrefix}(\\s+)${upgrade.depName}.*?(\\s?)${
        upgrade.fromSuffix
      }\n`
    );
    let newLine = `$1${upgrade.fromPrefix}$2${upgrade.newFrom}$3`;
    if (upgrade.fromSuffix.length) {
      newLine += `${upgrade.fromSuffix}`;
    }
    newLine += '\n';
    const newFileContent = currentFileContent.replace(oldLine, newLine);
    return newFileContent;
  } catch (err) {
    logger.info({ err }, 'Error setting new Dockerfile value');
    return null;
  }
}
<commit_msg>fix: use escaped line returns in docker regex escape<commit_after>module.exports = {
  setNewValue,
};

function setNewValue(currentFileContent, upgrade) {
  try {
    logger.debug(`setNewValue: ${upgrade.newFrom}`);
    const oldLine = new RegExp(
      `(^|\\n)${upgrade.fromPrefix}(\\s+)${upgrade.depName}[^\\s]*(\\s?)${
        upgrade.fromSuffix
      }\\n`
    );
    let newLine = `$1${upgrade.fromPrefix}$2${upgrade.newFrom}$3`;
    if (upgrade.fromSuffix.length) {
      newLine += `${upgrade.fromSuffix}`;
    }
    newLine += '\n';
    const newFileContent = currentFileContent.replace(oldLine, newLine);
    return newFileContent;
  } catch (err) {
    logger.info({ err }, 'Error setting new Dockerfile value');
    return null;
  }
}

{'fraction_non_alphanumeric': 0.17091660923501034, 'fraction_numerical': 0.004135079255685734, 'mean_word_length': 3.4, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1435901', 'n_tokens_mistral': 503, 'n_tokens_neox': 490, 'n_words': 90}