Having just started learning about regular expressions, I came across various confusing answers while looking for a solution. I'm hoping someone here can assist me. I need to validate an input field for MM/DD format while allowing only numbers to be entered.
ng-pattern="/^0|[1-9]\d*$/"
In our application, we use the MM/YY format with the '/' automatically inserted using jQuery's .keypress function. Surprisingly, the field validates correctly until after the '/', at which point it only validates the last two numbers.
Is there a pattern that can ignore the '/' character so that the entire field can be validated for numbers only?
I appreciate any assistance you can provide. Thank you.