Regex matching help for replacing text

Hi there

I am trying to build a JavaScript regex to strip out the & from the key in this example:

c&.a.&activitymap.&page=https%3A%2F%2Fsitdev.online¤cy=eur

if there are any matches it would give this result:

c.a.activitymap.page=https%3A%2F%2Fsitdev.online¤cy=eur

What I have tried:

I have tried a several times to match these results but no luck with this regex:


([^=&]*(?:=[^=&]*&[^=&]*)?)&

Here is a reg ex example, but I need it to match every key/value not just the first 2:

regex101 debugger[^]

Thanks

Read more here: Source link