I tried the following but it is not working:
If by "relative URL" you mean the part of the string after the first single
/, then it's simple:
This matches all the characters up to the first single
/ in the string and replaces them with the empty string.
http://localhost/my/page.jsp --> Out: