Skip to content

Instantly share code, notes, and snippets.

@IanMulvany
Created August 23, 2013 10:27
Show Gist options
  • Save IanMulvany/6317811 to your computer and use it in GitHub Desktop.
Save IanMulvany/6317811 to your computer and use it in GitHub Desktop.
Just showing the quick changes I have been making in function buildDocs(cb) {
// From >
// This needs to be tweaked for every type of source
var id = /elife(\d+)\.xml/.exec(url)[1];
// TO :
// This needs to be tweaked for every type of source
// as an id we want anything between the last "/" and the last ".xml"
var urlParts = url.split("/");
// pick up the last elemet of the url
var xmlFilename = urlParts.pop();
console.log(xmlFilename);
// drop ".xml"
var id = xmlFilename.replace('.xml', '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment