4

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

Cody Gray
  • 230,875
  • 49
  • 477
  • 553
Hemant Kumar
  • 4,493
  • 9
  • 53
  • 93
  • 1
    How do you define "special character". Is `é` a special character? How about `商`? – Fredrik Mörk Apr 14 '11 at 05:29
  • Is space a spacial character? The question would be much more answerable with a few valid/invalid examples. – Kobi Apr 14 '11 at 05:33
  • possible duplicate of [Regular Expression for alphanumeric and underscores](http://stackoverflow.com/questions/336210/regular-expression-for-alphanumeric-and-underscores) – Cody Gray Apr 14 '11 at 05:34
  • The special charaters are here " ( )[ ]{ }*& ^ % $ # @ !" please privide me the solution – Hemant Kumar Apr 14 '11 at 06:10

2 Answers2

6

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

Oleks
  • 31,334
  • 11
  • 76
  • 131
Jess
  • 2,943
  • 3
  • 26
  • 40
4

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

bw_üezi
  • 4,371
  • 4
  • 21
  • 41