Im trying to use javascript and regex to replace a substring in a url.
myurl.com/?page_id=2&paged=2
shall become
myurl.com/?page_id=2&paged=3
this is my code that doesnt seem to work:
nextLink = 'myurl.com/?page_id=2&paged=2'
nextLink = nextLink.replace(/\/paged\=\/[0-9]?/, 'paged='+ pageNum);
What am i doing wrong here? Im new to regex.