• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular expression for only alphabetics  RSS feed

 
Purohit Punam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to check only alphabets for that i used regular expression as .
But it is accepting numbers also can any one help me getting regular expression for validating only alphabets..

Thanks,
Punam Purohit
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it is accepting numbers also

Really ? How are you using it ?
 
Purohit Punam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:
But it is accepting numbers also

Really ? How are you using it ?


I was using it as below:

and it gave me true....
yeah... I got it done using this expression:
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing remotely related to GWT.
Moving thread.
CarefullyChooseOneForum
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Purohit Punam wrote:
yeah... I got it done using this expression:


Another option is to use the matches() method (instead of the find() method). With that, it must match the whole string, and your regex doesn't need to have "^" and "$" as part of it.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!