var str = "/index.php?module=content&cat=xxx&action=add", a = "12345" ; str = str.replace(/(cat=)[^&]*/,"$1"+a); alert(str);