Js string replacement problem

want to do a click to jump to the js method of url.

clipboard.png

Click submit, take the values of the two input, and
replace the last two zeros with the string var str= "http://www.baidu.com/loupan_0_0_0_0_0_0_0_0_0_0.html"
, which is spliced into
" http://www.baidu.com/loupan_0_0_0_0_0_0_0_0_1000_20000.html"

.

function replace(str, minPrice, maxPrice){
    return str.replace(/^http:\/\/www.baidu.com\/loupan((_[0-9]+){8})_([0-9]+)_([0-9]+).html$/, `http://www.baidu.com/loupan$1_${minPrice || 0}_${maxPrice || 0}.html`)
}

test:
clipboard.png


var str="http://www.baidu.com/loupan_0_0_0_0_0_0_0_0_0_0.html";
str.replace(/\d_\d(?=\.html)/,"1000_20000");
Menu