RegEx required to remove all alphabets from string

I need a regex to traverse all alphabets from string (AZ) and (az). Everything, including any special symbol, must remain intact. I tried @ "[^ \ d]" but it only returns the numbers in the string.

String : asd!@# $%dfdf4545D jasjkd #(*)jdjd56

desired output : !@# $%4545 #(*)56

      

+3


source to share


2 answers


Just replace any unwanted characters with an empty sequence of lines:



string filtered = Regex.Replace(input, "[A-Za-z]", "");

      

+11


source


Try the following regex:

[^a-zA-Z]

      



This will match all non-English letters.

+2


source







All Articles