Regex Based URL Parser
This Code parse any type of URL into different sections through a regex.
HTML
<input type="url" id="url" />
<button id="bt">Parse</button>
<br/>
<pre id="dd">
</pre>
JavaScript
function parseURL() {
var regex = /^(([A-Z|a-z]:\\\\)|(\\\\\\\\))([^<>:"\/\\|?*.]+)((\\\\[^<>:"\/\\|?*.]+)*)/gi;
var str = '\\\\\\\\tahoe\\2015.01_STP-ENG\\winintel\\static_content\\mp_int_out_rec ';
alert(str.search(regex));
var isPath = str.search(regex) === 0;
alert(isPath);
}
$("#bt").click(function(e) {
console.log(parseURL());
})