...
Code Block |
---|
([1-9]|[1-3][0-9]|4[0-2]) |
Patterns i.e. regular expressions take into consideration each character that is entered instead of the whole value that is entered. Here is the explanation for the pattern shown above:
- [1-9] – means any number between one and nine will satisfy the pattern. So this covers the range of numbers between 0 and 9.
- | - OR operator
- [1-3][0-9] – means first digit can be between 1 and 3 and second digit can be between 0 and 8 to satisfy the pattern. So this covers the range of numbers between 10 and 39.
- | - OR operator
- 4[0-2] – means first digit can be 4 and second digit can be 0 or 1 or 2 to satisfy this pattern. So this covers the range of numbers between 40 to 42
Numbers with commas
' default number control supports digits followed by an optional decimal point and multiple decimal places. Suppose instead you want to allow numbers containing commas and optionally starting with a '$' and only up to 2 decimal places. For example: $1,000.50 2,500. But also to allow numbers without the comma such as $1000. To do this:
...