I have to accept the inputs that meet these rules ...
- 0.25 -24
- Increase of .25 (.00, .25, .50, .75)
- The first digit is not required.
- Example of some valid listings:
- 0.25
- .50
- 1
- 1.75
- 23.75
- 24 (maximum permissions)
- update
Update: Nothing, empty / blank should also be accepted as valid
Some invalid entries Example:
- 0
- .00
- 0.0
- 0.00
- 24.25
- -1
I understand that RegEx is a pattern matching language, so this ranges, at least, And is not great compared to checking so to verify whether it is less than 24 or equal, I find a pattern, right? So there are 24 possible peters, which would make it a long RegEx, am I understanding it correctly? I can use ColdFusion to make a check to make sure that it is in the 0-24 range. This is not the end of the world if I have used coldfusion for this part, but all of them get in regx It would be good to do so if it does not have to be too long. This is what I have done so far:
It handles it too much except for a 0-24 range probe or just a check for a zero, but I keep it away Thanks also! change You can go to To exclude 24.25, you might use a negative LookIahad To prevent anything from Includes a check for For comparison, here is a pure-Sifmel way to do it: Now, are you really sure that it is better as a reggex ... ^ \ d {0,2} (((| 0 | 00 | 25 | 5 | 50 | 75)) $ $
\ d {0,2} < / Code> to
(?: 1 [0-9]? | 2 [0-4]? | [3- 9])?
and match it from 1 to 24 (or nothing) (?:? (? (? (? 00? | 25 | 50? | 75))
- You can go to (?: \. (?: [05] 0? | [27] 5))?
But this may obscure a little more distant intent. (? 24 \. [^ 0])
24.0 or 24.00, but mainly for excluding 24, 24 / 24.0 / 24.00 for one Specific checks include Start:
(? X) # 24 24 24 24 $ | ^ 24 \ .00? Check for # $ for integer ^ ^ (?: 1 [0- 9]? | 2 [0-3]? | [3- 9] | 0 (? = \. [^ 0]) | (? = \. [^ 0])) # decimal part (?: \. (00? | 25 | 50? | 75))? $
0 (? = \. [^ 0])
, which would allow only the initial 0 Uses a positive form for
if the next letter is a .
After that a non-zero (0.0 and 0.00 are not allowed). (? X)
allows the flag to ignore white space, allowing readable Rijaks in your code - for all squash in a row better - and it can start also makes clear that #
to use to clarify parts of the line comments to escape with a pattern of (literally white space and hash backslash , Or for the hash like \ x23
by anco It can be.)
IsNumeric (Num) and the number of GM 0 No. LTE 24 and not ('.', Number * 4)
Comments
Post a Comment