Remove a URL search parameter when there is duplicate names?

I am trying to manipulate my URL using URLSearchParams. However URLSearchParams.delete() expects the name of the param. If I have params with the same name, (from what I’ve tested) the function only removes the last matching param. Is there a way to delete by both name and value?

My query looks something like this:

?color[]=Black&color[]=Green&material[]=Steel

So when I call .delete("color[]") it will remove the color[]=Green param, but what if I want to remove color[]=Black?

The reason for the duplicate names is the backend (PHP) is leveraging this functionallity to auto parse the parameters into arrays…which requires the syntax above.

Big picture is- I’m trying to add/remove “filters” from this array-to-be. Also, some filter categories could have matching values so I don’t want remove by value either. I am open to considering an entirely new approach…just trying to do it in the least hacky way.