I am trying to use regex to validate that a variable is an integer between 1 and n. I was thinking that I could use "matches" then input ^(?:100|[1-9][0-9]|[1-9])$ but that doesn't seem to work. Ideas?
Why use RegEx instead of a calculation?
- Calculations user manual section.
Assuming I haven't missed the obvious -- what's a good way of checking for integeriness? Perhaps
if TRUNC(x) = x?
I would have probably used
MOD, but I believe it does not work as expected in KM – so I think your solution is probably the simplest.
MOD treats everything as integers, IIRC.
So -- POC time:
Integer Test POC.kmmacros (2.7 KB)