I have the below code. It works only when I have 2 digits. If I have 1 digit doesn't work. I want to work in both cases: one or two digit.
var numberRegex = /^[1-9][0-9]$/;
var numberRegex = /^[1-9]?[1-9][0-9]$/;
Try this one out:
Reading what you have it looks like you don't want to accept numbers like