How to strip out all characters except for numbers, letters, quotes, and colons/semi-colons?

Posted by evanmortland on Stack Overflow See other posts from Stack Overflow or by evanmortland
Published on 2010-04-25T16:15:04Z Indexed on 2010/04/25 16:23 UTC
Read the original article Hit count: 184

Filed under:
|

Hello,

I have a document that I'm parsing text out of - I'm trying to figure out how to use this RegEx expression to take out everything that isn't alphanumeric, but I want to keep quotes, ampersands and colons/semi-colons.

               s = Regex.Replace(s, @"[^\w-]+", " ");

How can I add a replace all of these "except these" pattern here?

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex