Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    Yes, this is fairly simple, perhaps follow it up with a replace of consecutive "-". Off the top of my head something like: cleaned = Regex.Replace(cleaned, @"--+",""); should do the trick. Commented Jul 24, 2009 at 10:40
  • Edited the answer to include my suggestion as it checked out. Hope you don't mind :) Commented Jul 24, 2009 at 10:43
  • I wouldn't mind if your edit is correct, but it isn't. My original regex replacement never produces consecutive dashes. Commented Jul 24, 2009 at 11:25
  • This yields "too many" hyphen characters in certain situations, including when you want to spell the name "O'Donnel". Commented Jul 24, 2009 at 11:28