• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regular expression for alphanumeric

 
kalyen kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey everybody,

I am trying to write a regular expression which accepts only alphanumeric

but the rule is ......it should not accept only alphabet or only numeric words

Examples:

word123--------> TRUE
123word--------->TRUE
word------------->FALSE (because only alphabet)
1234------------->FALSE (because only numeric)

Can any one help me in writing this.......

Thanks in advance

 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it's pretty straightforward -- what have your tried so far?

Henry
 
kalyen kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just found that this is working......



am I correct....?
still any easy way to do this...

 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

am I correct....?


yes...

still any easy way to do this...


Well. That depends.... Did you read up on regexes and figured out the solution yourself? Or did you simply got the solution from someone else? We can't really give you a hint on an "easier way" (assuming that there is one), if you don't understand this regex.

Henry


 
kalyen kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks for your support,

Actually, I needed this regex somewhere in between my project.
As I had little time and as I am not an expert of regex, so tried to understand some basics of it.
I searched for the answer but could find only a close answer, so i modified it to suit my requirement.

My knowledge in regex is, I can only understand them but writing them on my own needs some more learning....

Once again thanks for your encouragement.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic