How can I change the comma separating two currencies in a string?

If I have a string value:
let x = ‘$2,500,$3,500’

What would be the best way in JavaScript to return

x = ‘$2,500|$3,500’

to the user?

I have tried messing around with some regex but am unsure how to either capture or ignore the numeric value in between the $ and ,

I feel like there has to be a simple way of doing this that I am missing. Please let me know if you need any more details and thanks in advance.