Can anyone tell me the regex for excluding numbers and special characters in ASP.NET?

12,676

Solution 1

Try the following: ^[a-zA-Z]*$

Solution 2

possible regex

[^()[\]{}*&^%$#@!]+

this will match anything but ()[]{}*&^%$#@!

the [^...]+ is a "any character except ..." and the ] must be escaped with \]

http://www.myregextester.com/?r=37f5dfd3

Share:
12,676
Hemant Kumar
Author by

Hemant Kumar

Passionate about developing community, evangelizing technology and, giving enthusiastic technical presentations with exceptional skills at developing and fostering personal relationships. Having working professional having 7+ years of experience on .NET technologies like C#.NET,VB.NET,ASP.NET MVC,jQuery,JavaScript,HTML,AngularJs and CSS. I can do this task with in the given time-line as per the requirement. Beyond application development, I am skilled in high-level requirements gathering, risk analysis, technical design analysis, application modelling, implementation planning, and support.

Updated on June 04, 2022

Comments

  • Hemant Kumar
    Hemant Kumar almost 2 years

    How do I get the regular expression for excluding special charaters and numbers? Thanks in advance.

    • Fredrik Mörk
      Fredrik Mörk about 13 years
      How do you define "special character". Is é a special character? How about ?
    • Kobi
      Kobi about 13 years
      Is space a spacial character? The question would be much more answerable with a few valid/invalid examples.
    • Cody Gray
      Cody Gray about 13 years
    • Hemant Kumar
      Hemant Kumar about 13 years
      The special charaters are here " ( )[ ]{ }*& ^ % $ # @ !" please privide me the solution