I have a validation regex, that checks that the user sent a query param in this format- an integer with max length of 10 - meaning it can be an integer between 0 and 10, and it can also contain leading zeros (any number of zeros at the beginning), but its optional.
Examples:
| String | Result |
|---|---|
| 12345 | valid |
| 000001234567890 | valid |
| 012345678900 | not valid |
| 12345678901 | not valid |
| 000000000012547 | valid |
this is my regex, but it doesn't seem to work
"^(0+)?|[0-9]{0,10}+$"
^(0+)? - this is suppose to be the optional leading zeros at the beginning
[0-9]{0,10}+ - this is suppose to be the integer with the length validation