Gold Gold - 1 year ago 96
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download