Validating number ranges would be very easy if we send numbers as normal json numbers. Unfortunately we send them as strings.
That means we have to use regex if we want to validate them. Validating numbers with regex is ackward, but possible. For example, to validate that a number is in the range 0-255, you can use:
Validating number ranges would be very easy if we send numbers as normal json numbers. Unfortunately we send them as strings.
That means we have to use regex if we want to validate them. Validating numbers with regex is ackward, but possible. For example, to validate that a number is in the range 0-255, you can use:
Ref: https://www.regular-expressions.info/numericranges.html#:~:text=Searching%20for%20Numeric%20Ranges,%2D5%5D)%5Cb.
Handling leading zero or whitespace need a bit more.
Do we want to go down this route? Or wait for a core spec that sends numbers in native format?