I need to use Regex.Replace to remove all numbers and signs from a string.
Regex.Replace
Example input: 123- abcd33 Example output: abcd
123- abcd33
abcd
As a string extension:
public static string RemoveIntegers(this string input) { return Regex.Replace(input, @"[\d-]", string.Empty); }
Usage:
"My text 1232".RemoveIntegers(); // RETURNS "My text "