I'm looking for a regular expression that will allow any number from 0 - 100, but there are some "numbers" that cannot be used. I have a maxlength input of 3 digits, numbers only.
Here is the general break-down:
numbers, only 0-9
100 is highest - so the only 3 digit number is 100
0 is lowest
number cannot start with 0, if more than 1 digit, like 032
number cannot start with 00, like 004, but can be 4
number CAN be 0
number can be one digit, like 1 or 9, not 01 or 09
number can be 2 digit, like 47 or 86, not 047 or 086
here is what I have so far, but is FULL of holes!
$number =~ /^[0-9]*$/g
$number <= 100
$number =~ s/^[0]*//g <- this screws things up, some
I've tried alot of different combinations, but none are exact. Can anyone see a simple solution?
Thanx!
Here is the general break-down:
numbers, only 0-9
100 is highest - so the only 3 digit number is 100
0 is lowest
number cannot start with 0, if more than 1 digit, like 032
number cannot start with 00, like 004, but can be 4
number CAN be 0
number can be one digit, like 1 or 9, not 01 or 09
number can be 2 digit, like 47 or 86, not 047 or 086
here is what I have so far, but is FULL of holes!
$number =~ /^[0-9]*$/g
$number <= 100
$number =~ s/^[0]*//g <- this screws things up, some
I've tried alot of different combinations, but none are exact. Can anyone see a simple solution?
Thanx!