I've a url ('https://xyz.abc.org.com/v1.5/wth/data/analysis/geo?run=run1&aaa=some') which remains the same till 'v1.5' till any api calls.
So I need to get the last part 'geo' out of the url.
Here's my code:
var testUrl = 'https://xyz.abc.org.com/v1.5/wth/data/analysis/geo?run=run1&aaa=some';
console.log(testUrl.substring(testUrl.lastIndexOf('/')));
But, this returns - 'geo?run=run1&aaa=some', while I want 'geo'.
How do I fix this?
Also, I can't use some numbers to get the substring out of it, as that part of the url will be different for different api calls.
I just need the part of the url after last '/' and before '?' or '&'.