Article 4S3SP Need working date pattern for html <input>

Need working date pattern for html <input>

by
mfoley
from LinuxQuestions.org on (#4S3SP)
I've tested various patterns, including going to http://html5pattern.com/Dates. No patterns work perfectly. The closest I've found is
Code:<input type="text" placeholder="mm/dd/yyyy"
pattern="(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d"/>but this one requires a 2 digit month, e.g. "01", instead of simply "1", and it requires a 4 digit year. For the latter, I'd like it to accept either 4 digits, or the last two digits only.

Does anyone know how I can modify the pattern to give me what I want?

Perhaps more importantly, is there a tutorial out there somewhere on these pattern regex's? I haven't been able to find anything.latest?d=yIl2AUoC8zA latest?i=F_aPiC4KHKc:wjIOyW5BMh0:F7zBnMy latest?i=F_aPiC4KHKc:wjIOyW5BMh0:V_sGLiP latest?d=qj6IDK7rITs latest?i=F_aPiC4KHKc:wjIOyW5BMh0:gIN9vFwF_aPiC4KHKc
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments