I am looking for removing foo parameter and its value from all the possible following query strings in Java.
Is there a regex pattern to do this?
http://localhost/test?foo=abc&foobar=def
http://localhost/test?foobar=def&foo=abc
http://localhost/test?foo=abc
http://localhost/test?foobar=def&foo=abc&foobar2=def
The resulting strings would be
http://localhost/test?foobar=def
http://localhost/test?foobar=def
http://localhost/test
http://localhost/test?foobar=def&foobar2=def
This regex should match the GET param and its value…
RegExr.
Just replace it with an empty string.