I want to get the relative URL from an absolute URL in JavaScript using regex and the replace method.
I tried the following but it is not working:
va
don't forget that \ is an escape character in strings, so if you would like to write regex in strings, ensure you type \ twice for every \ you need. Example: /\w/ → "\\w"
\
/\w/
"\\w"