replacing strings with regex in javascript
- by koko
Hi,
regex is bugging me right now. I simply want to replace the range=100 in a string like
var string = '...commonstringblabla&range=100&stringandsoon...';
with
...commonstringblabla&range=400&stringandsoon...
I successfully matched the "range=100"-part with
alert( string.match(/range=100/) );
But when I try to replace it
string.replace(/range=100/, 'range=400');
nothing happens, the string still has the range=100 in it... I don't get it, please help.