This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes RegEx Validation for a numeric range Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "RegEx Validation for a numeric range" Watch "RegEx Validation for a numeric range" New topic
Author

RegEx Validation for a numeric range

S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Hi,
I am totally unexposed to RegEx in any form and i have to solve this problem
:
If i have a number X, i want X to be a two digit number within this range
01 < X < 32
I have tried some reg-expressions but nothing seems to be working.
Can anyone help me with this ?

Thanks
Bitz
[ August 17, 2006: Message edited by: S bitz ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You try [1-31]?

Eric
S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Hi Eric,
Well your idea would've worked fine if the requirement was just for any number between 1-32, but the requirement here is that it should be a two digit number and if it is a number between 1 - 9 then it should be written like 01 or 02 or 09...
Hope you've got the situation now.

Thanks
Bitz
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RegEx Validation for a numeric range
 
Similar Threads
ArrayList index out of bounds? Prime numbers?
Regular Expression Help
A basic problem
int as expression value
include action tag in JSP