I need to replace substring in string.
String is
/string/otherstring?query=d78f1dbee59de41245fbf3c82b72b859ab688e30
Substring
query=d78f1dbee59de41245fbf3c82b72b859ab688e30 I need to replace to query=
I want to replace it using regexp and then using string.replace. But I can't write the regexp.
/\/string\/otherstring?query=/.exec(
'/string/otherstring?query=d78f1dbee59de41245fbf3c82b72b859ab688e30'
)
It's not working.
P.S. d78f1dbee59de41245fbf3c82b72b859ab688e30 is sha1 hash
"/string/otherstring?query=yoursha1hash".replace(/query=yoursh1hash$/, "query=");