I need to replace everything between :
and ,
with a |
multiple times.
I have a server list like server1:127.0.0.1,server2:127.0.0.2,server3:127.0.0.3
.
Basically, I need to remove all the IPs and replace them with some |
.
So far I was able to do this:
resultList = serverList.replace(/:.*,/g, '|')
The problem is that the result list is server1|server3:127.0.0.3
.
How can I replace every occurrence?