I want to replace all sequential commas ,, with {"v":""}
for e开发者_C百科xample ,,,,, would also be replaced.
I've tried
preg_replace('/,+/',',{"v":""},', $string);
Though I probably got something wrong. Any help would be appreciated. Thank you.
This should do what you want:
preg_replace('/,{2,}/', ', {"v":""}', $string);
However, a simple regular expression isn't the best tool for this job because it will break as soon as there is a string containing multiple commas.
加载中,请稍侯......
精彩评论