For example i got that string 1500,,,4000,5000
i need to delete ,,
commas, so this is came up with 1500,4000,5000
Another example: ,Banana,,Apple,,,,Watermelon,
to became as clean as possible Banana,Apple,Watermelon
For example i got that string 1500,,,4000,5000
i need to delete ,,
commas, so this is came up with 1500,4000,5000
Another example: ,Banana,,Apple,,,,Watermelon,
to became as clean as possible Banana,Apple,Watermelon
1
Answers
A simple regular expression of
,{2,}
will match any instance of 2 more more commas in a row. All matches of that can be replaced with a single comma.