I think this is the sort of thing your looking for.
$('#btn').on('click', function(){
var url = 'http://www.example.com/#articles/123456/';
var bitAfterHash = url.split('#').pop();
var parts = bitAfterHash.split('/');
var firstPart = parts[0];
var lastPart = parts.pop() == '' ? parts[parts.length - 1] : parts.pop();
$('p').html(firstPart + ' : ' + lastPart);
});
DEMO
Hope this helps.
Edit: or in a plain js function that you pass the url to.
function getUrlParts(url){
var bitAfterHash = url.split('#').pop();
var parts = bitAfterHash.split('/');
var firstPart = parts[0];
var lastPart = parts.pop() == '' ? parts[parts.length - 1] : parts.pop();
document.getElementById('text').innerHTML= firstPart + ' : ' + lastPart;
};
String.prototype.split()