Skip to content Skip to sidebar Skip to footer

Regex Patern To Match Dimensions From A String

I apologize if this is a duplicate, but I've searched for 3 hours already and couldn't find anything that doesn't deal with only a single pattern. I use a dimensions parameter in a

Solution 1:

Use this one:

var oldSid = newRegExp("sid=\\d{1,5}x\\d{1,5}");

...or (as it's not a dynamic regular expression) this one:

var newUrl = oldUrl.replace(/sid=\d{1,5}x\d{1,5}/, newSid);

Solution 2:

Use regex sid=[0-9]{1,5}x[0-9]{1,5} to find such match...

Test it here.

Post a Comment for "Regex Patern To Match Dimensions From A String"