Skip to content

Instantly share code, notes, and snippets.

@hayleyxyz
Created June 5, 2020 12:55
Show Gist options
  • Save hayleyxyz/fa6d7b9e5504b7e8bedb320ee150ea00 to your computer and use it in GitHub Desktop.
Save hayleyxyz/fa6d7b9e5504b7e8bedb320ee150ea00 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const xmlstr = fs.readFileSync('BingConfiguration\\BingConfiguration_common.xml').toString();
const m = xmlstr.match(/[a-z\.]+\.com/ig);
const hosts = [ ];
for (let index = 0; index < m.length; index++) {
const element = m[index];
if(!hosts.includes(element)) {
hosts.push(element);
}
}
const hostsLine = `127.0.0.1 ${hosts.join(' ')}`;
console.log(hostsLine);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment