I have been using jQuery address plugin and it passes an event.value which might result in /messages/inbox/
. I want to be able to turn that into Messages Inbox
.
I am not sure which regex to use and how to do this. Currently I have this, but this is just way too messy for me.
var href = event.value != '/' ? event.value : '/wall/';
var title1 = href.replace('/', "");
var title2 = title1.replace('/', " ");
var myTitle = title2.replace('/', "");
$.address.title("My-Site | " + myTitle);