Skip to content

Instantly share code, notes, and snippets.

@saptak
Created April 22, 2015 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saptak/5f1de4173f9d6e85e122 to your computer and use it in GitHub Desktop.
Save saptak/5f1de4173f9d6e85e122 to your computer and use it in GitHub Desktop.
find location of the port number in a URL
var str1="http://127.0.0.1:5000";
var str2="http://blah.blah.com";
var i1=str1.search(/:\d/);
console.log(i1);
i1=str2.search(/:\d/);
console.log(i1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment