I've read other pages supplying the RegEx, but the post doesn't seem to be working in my tests. I'm just wanting to remove the page=X
portion from a url string (/search?page=2&some_var=foo
).
When I try this:
urlStr = req.url
urlStr.replace(/&foo(=[^&]*)?|^foo(=[^&]*)?&?/, '')
It doesn't remove the page portion. If I move the page to the end or middle of the string the RegEx elector works.
Anyone have a better Reg Ex solution? I'm only going to have a few query strings so I'm pretty sure I'm not going to run into edge cases.