Skip to content

Instantly share code, notes, and snippets.

@jspc
Created July 27, 2016 16:31
Show Gist options
  • Save jspc/273c61edb60c617289a4c44fac011004 to your computer and use it in GitHub Desktop.
Save jspc/273c61edb60c617289a4c44fac011004 to your computer and use it in GitHub Desktop.
var uri = "http://domain.com:80/articles/something";
var regexp = /http:\/\/([^\/]+):[0-9]+\/articles\/[^\/]+/;
var matches = regexp.exec(uri);
console.log(matches);
//[ 'http://domain.com:80/articles/something',
// 'domain.com',
// index: 0,
// input: 'http://domain.com:80/articles/something' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment