Gold Gold - 11 months ago 44
C# Question

How to remove numbers from string using Regex.Replace?

I need to use

to remove all numbers and signs from a string.

Example input:
123- abcd33

Example output:

Thanks in advance.

Answer Source

Try the following:

var output = Regex.Replace(input, @"[\d-]", string.Empty);

The \d identifier simply matches any digit character.