I'm trying to get rid of the protocol and domain from a URL in jQuery with .replace() and regex, but it leaves the string exactly the same no matter what.
var selectedDocumentUrl = "http://mysite.test.com/files/somefile.pdf";
var assetUrl = selectedDocumentUrl.replace('/http://[^\/]+/g', '');
Here is a jsfiddle of the code