-1

I have a string with different parameters like that:

let params = project=ab_cd&language=en&client=core

Now I want to remove the project parameter "project=ab_cd". This can look different.

So the desired reuslt is:

params = language=en&client=core

I tried that with RegEx:

let outParams = params.replace(/.*project=.*&/, "");

When I just have the project parameter and one other, it works. But when there are at least 3 parameters, it's not working. I think I have to specifically say replace until the first &

Does someone know how to do that? Or is there maybe a better solution in javascript without RegEx?

Thalia
  • 23
  • 3

0 Answers0