Skip to content

Instantly share code, notes, and snippets.

@MiguelCastillo
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save MiguelCastillo/88a545e7b740241753e2 to your computer and use it in GitHub Desktop.

Select an option

Save MiguelCastillo/88a545e7b740241753e2 to your computer and use it in GitHub Desktop.
Regex to parse FILE urls
// http://regex101.com/r/zT4pG0/6
function parseUrl (urlString) {
return /(?:^(file:)(\/\/\/?))?(([A-Za-z-]+:)?[/\\d\w\.\s-]+)/gmi.exec(urlString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment