I'm getting a url then stripping the domain with an onClick handler in React using a regEx like this :
const path = e.target.closest('a');
if (!path) return;
e.preventDefault();
console.log('path: ', path.href.replace(/^.*\/\/[^\/]+/, ''));
So if the url was say http://example.com/my-super-funky-page, it will correctly console.log everything after http://example.com - eg :
/my-super-funky-page
But I seem to have an issue with the regEx containing a useless escape. JS Lint reports :
Unnecessary escape character: \/ no-useless-escape
What do I need to remove to still make this work as expected. I tried a few things and it broke the result.