How to write regex to match only one digit at end of pattern? -


my field supposed in format of a111-1a1, regex allows last number more 1 digit (eg. a111-1a1212341). how fix this?

below regex using.

var validchar = /^[a-z](([0-9]{3})+\-)[0-9][a-z][0-9]+$/; 

remove + @ end of pattern. allows more 1 numeric @ end.

var validchar = /^a-z[0-9][a-z][0-9]$/; 

however, pattern otherwise doesn't right want. exact pattern using?


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -