var reg = /(page=)(\d+)(\&url)/; var qwer = "http://site.ru/index.php?page=589&url=http%3A%2F%2Fdomen.ru%2F"; qwer = qwer.replace(reg, function(all, one, two, three){return one+((Number(two)||0)+1)+three});