I have this regex formula in a google forms field. It validates that users don't input decimals,".0" or ",00" because it messes up my calculations on submits.
Now i need to add to this validation a minimum number. So that users don't input a number under 120. Is this possible?
If its possible, is also posible to put a max number, so the input can only be in a certain range. Maybe 120>X<1000
Thanks!
You can use
^(1[2-9][0-9]|[2-9][0-9]{2})$
This regex will only allow whole integer numbers from 120 to 999.
See regex demo
Explanation:
1[2-9][0-9]
- Alternative 1: 1
followed by 2-9
digit range, followed by 0-9
digit range|
- alternation operator[2-9][0-9]{2}
- Alternative 2: 2-9
digit range, followed by 2 occurrences of (due to {2}
) 0-9
digit range.