Struggling to extract a relative path from a URL. For example, from , I want to get /my/path.
I attempted the following:
url = 'http://test.com/my/path';
console.log(url.replace(/^(?:\/\/|[^\/]+)*/));
Unfortunately, I am only getting undefined/my/path as a result.
Any insights into why I'm getting undefined? Is there an issue with my regular expression?