Need RegEx to remove all alphabets from string

前端 未结 2 984
梦如初夏
梦如初夏 2021-01-14 05:10

I need a regex to move all alphabets from string (A-Z) and (a-z)..everything including any kind of special character should remain intact. I tried @\"[^\\d]\" but it only re

相关标签:
2条回答
  • 2021-01-14 05:51

    Try the following regular expression:

    [^a-zA-Z]
    

    This will match all non-english letters.

    0 讨论(0)
  • 2021-01-14 05:57

    Just replace all undesired characters with an empty string sequence:

    string filtered = Regex.Replace(input, "[A-Za-z]", "");
    
    0 讨论(0)
提交回复
热议问题