15
I would like to create a regex in C# that removes a specific character if it is repeated and so it is not the last character of the string.
Example:
"a--b-c-" => "a-b-c"
"-a-b--c" => "a-b-c"
"--a--b--c--" => "a-b-c"
I never want the - repeated, and I never want it to be the first or last character of my string. How could I write a regex to do this?