function example(){
var quantity = "http://www.example.com/index.php?brandid=b%123&quantity=20";
quantity = quantity.replace(-what regular expression should i user-, "quantity=50");
}
i want to replace only the quantity=20 to quantity=50 in link. but i have tried some of the regular expression such as:
replace(/quantity=[^\d]/g,"quantity=50");
replace(/quantity=[^0-9]/g,"quantity=50");
so i would like to have some help from expertise in regular expression to help me =) thanks
^in the [0-9] part. The caret there says to find anything but what follows. Instead, try this:[0-9]+, as it will match any number one or more times.