Replace [^a-zA-Z0-9 -]
with an empty string.
Regex rgx = new Regex("[^a-zA-Z0-9 -]");
str = rgx.Replace(str, "");
More Related Contents:
- How do I get two numbers between two words (C#) [closed]
- C#. split identificator on the words [closed]
- \d less efficient than [0-9]
- Regex for numbers only
- Find and extract a number from a string
- How can I strip HTML tags from a string in ASP.NET?
- regex for accepting only persian characters
- Order of regular expression operator (..|.. … ..|..)
- Add spaces before Capital Letters
- Replace only some groups with Regex
- What’s the difference between “groups” and “captures” in .NET regular expressions?
- Remove HTML tags from string including   in C#
- Regex: I want this AND that AND that… in any order
- How to read RegEx Captures in C#
- Best Regular Expression for Email Validation in C#
- Remove text in-between delimiters in a string (using a regex?)
- Poor man’s “lexer” for C#
- How to get text between nested parentheses?
- Using WebClient in C# is there a way to get the URL of a site after being redirected?
- Translate Perl regular expressions to .NET
- Are Java and C# regular expressions compatible?
- C# – Regex for file paths e.g. C:\test\test.exe
- C# Regular Expressions, string between single quotes
- How do I get the name of captured groups in a C# Regex?
- C# Regex.Split: Removing empty results
- How to use inline modifiers in C# regex?
- Regular expression to find and remove duplicate words
- Regular expression to split string and number
- regex to find a word before and after a specific word
- Replace all occurrences of the Tab character within double quotes