I have jquery regex that finds the web address URL at the top and replaces it with a new url, however the regex that I have written changes the url but regex is adding other the extra stuff from the URL at the end. It's adding 3543463456546456
at well instead of https://127.0.0.1/id=12345
<script>
var urlTest = $(location).attr("href");
var test1 = urlTest.replace(/https:\/\/127.0.0.1\/test1\/test2\/(12345)\/3543463456546456/g, "https://127.0.0.1/id=$1");
$(".test").append(document.write(test1));
</script>
Not sure why its picking up 3543463456546456