I'm trying to build up some regular expressions to validate some textbox controls. I have done some research and testing but cannot get this one working. Examples of what i am trying to create regular expressions for are as follows:
- Range 0-45, 0 decimal places
- Range 0-20, 2 decimal places
- Range 16-65, 0 decimal places
- Range 0-99, 2 decimal places
- Range 0-1500000, 0 decimal places
- Range 0-200, 1 decimal place
For 1 and 5 respectively, I have used
([0-9]|[0-9]\d|45)$
([0-9]|[0-9]\d|1500000)$
The first one I am having problems for is an age range of 16-65 (inclusive), where I want no decimal places. After a post on here (Regular expression to allow numbers between -90.0 and +90.0) I thought I could use the logic and get it sussed, but can't!
The expression I got to was:
(\d|([1-6][6-4]))|65
Can someone please tell me where I'm misunderstanding this! And any help with the other examples above would be gratefuly received.