C# Regular Expression to match letters, numbers and underscore

前端 未结 4 913
感动是毒
感动是毒 2020-12-29 03:29

I am trying to create a regular expression pattern in C#. The pattern can only allow for:

  • letters
  • numbers
  • underscores

So far I

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 04:23

    Regex

    packedasciiRegex = new Regex(@"^[!#$%&'()*+,-./:;?@[\]^_]*$");
    

提交回复
热议问题