我正在寻找从 Java 中所有可能的以下查询字符串中删除 foo
参数及其值的方法。
是否有正则表达式模式可以执行此操作?
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
结果字符串将是
http://localhost/test?foobar=def
http://localhost/test?foobar=def
http://localhost/test
http://localhost/test?foobar=def&foobar2=def
最佳答案
关于用于从查询字符串中删除参数的 Java 正则表达式模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9191327/