Jump to content

Help with replace!


stuckwithcode

Recommended Posts

Hello,

 

The code below alows me to replace the sequence ", , " with just one ", "      (comma then a space)

 

text = text.replace(/[,]\s[,]\s/gm,", ");

 

How can I amend the code so that however many I have in a row eg . ", , , , , " or ", , , " all get changed to one ", "

 

Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/188348-help-with-replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.