code: function replaceThaliConfig (rootDir) {
    // example: 'SSDP_NT: process.env.SSDP_NT || 'http://www.thaliproject.org/ssdp','
    // or: SSDP_NT: 'http://www.thaliproject.org/ssdp',
    // We want to replace it with random string.
    var value = randomString.generate({
      length: 'http://www.thaliproject.org/ssdp'.length
    });
    var replacement = {
      pattern: new RegExp(
        [
          '(',
          'SSDP_NT', '\\s*', ':',
          ')',
          '(',
          '\\s*', '.*?', ',',
          ')'
        ].join('')
      ),
      value: '$1 \'' + value + '\','
    };
    return replaceStringsInFile('thaliConfig.js', rootDir, [replacement]);
  }
docs: Our task is to replace 'b' between 'a' and 'c' with other value. We couldn't use the simpliest solution: 'abc'.replace(/(?<=a)(b)(?=c)/, 'q') (?<=...) is not supported in nodejs (we don't want to require 'pcre' here). So we have to use: 'abc'.replace(/(a)(b)(c)/, '$1q$3')