Given the input string "Test,,test,,,test,test"
and using the following C# snippet I would have expected the duplicate commas to be replaced by a single comma and results in...
"Test,test,test,test"
private static string TruncateCommas(string input)
{
return Regex.Replace(input, @",+", ",");
}
Code was pinched from this answer... C# replace all occurrences of a character with just a character
But what I am seeing is "Test,,test,,,test,test" as the output from this function.
Do I need to escape the comma in the regex? Or should this regex be working.