regex - regular expressions to check length with multiple options -


i need validate date format, can either 11/11/11 or 11/22/2013, i.e. year block can in yy or yyyy , complete format either mm/dd/yy or mm/dd/yyyy

i've code

^(\d{1,2})\/(\d{1,2})\/(\d{4})$ 

and i've tried

^(\d{1,2})\/(\d{1,2})\/(\d{2}{4})$ // doesn't works, nothing 

and

^(\d{1,2})\/(\d{1,2})\/(\d{2|4})$ // , returns null every time 

ps: i'm applying javascript/jquery

^(\d{1,2})\/(\d{1,2})\/(\d{2}|\d{4})$ 

both \d{2}{4} , \d{2|4} not correct regex expression. have two digits , for digits separately , combine using or: (\d{2}|\d{4})


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -