I'm a total noob with regexes and although I was trying hard I cannot create proper regexes to perform the following operation :
- take url and check if it has a '
?' followed by number with varying amount of digits. - if the match is correct, get the number after the '
?' sign - exchange this number with different one.
So let's say we have this url :
http://website.com/avatars/avatar.png?56
we take '56' and change it to '57'.
I have the following regex for searching, I'm not sure if it's proper :
\?[0-9]+
But I have no idea how to take ? away. Should I just throw it away from the string and forget about using regex here ? Then the replace part is the only one left.
locationobject, respectivelylocation.search.?you take out. See my answer below.