I've been looking at regex help pages but cant seem to find/understand a solution.
My problem is: I want a regex that allows either specifically a number or a range of numbers that will be integrated in a code for data input validation. For example one can only input either "12" or "12-50" with that exact same format, no extra dashes or anything.
The solution I created for the ex."12-50" is [0-9][-][0-9]
and works perfectly fine. However I can't integrate the above regex with one that will allow that format and also the format of just a single number.
I tried using the OR operator, [0-9]|[0-9][-][0-9]
, however it doesn't seem to work perfectly as I can input "incorrect formats" such as "12-","123---" etc.