i need replace substring in string.
string is /string/otherstring?query=d78f1dbee59de41245fbf3c82b72b859ab688e30
substring query=d78f1dbee59de41245fbf3c82b72b859ab688e30 need replace query=
i want replace using regexp , using string.replace. can't write regexp.
/\/string\/otherstring?query=/.exec( '/string/otherstring?query=d78f1dbee59de41245fbf3c82b72b859ab688e30' ) it's not working.
p.s. d78f1dbee59de41245fbf3c82b72b859ab688e30 sha1 hash
use string.replace . don't need apply exec function.
string.replace(/(\/string\/otherstring\?query=)[a-za-z0-9]+/g, "$1") or
try if want deal lowercase letters , numbers.
string.replace(/(\/string\/otherstring\?query=)[a-z\d]+/g, "$1")
Comments
Post a Comment