<blockquote>
	<p>“Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.”</p>
	<footer>— <cite>Jamie Zawinski</cite></footer>
</blockquote>

<!-- Don’t do this! -->
<p>
	<label for="yyyy-mm-dd">date in yyyy-mm-dd format</label>
	<input id="yyyy-mm-dd" pattern="-?\d*(?:(?:(?:(?:[02468][048]|[13579][26])(?:[02468][048]|[13579][26])|(?:[02468][1235679]|[13579][01345789])(?:0[48]|[2468][048]|[13579][26]))-02-(?:0[1-9]|[12]\d)|(?:(?:[02468][1235679]|[13579][01345789])00|\d\d(?:[02468][1235679]|[13579][01345789]))-02-(?:0[1-9]|1\d|2[0-8]))|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)))"/>
</p>
<p>
	<label for="dd-mm-yyyy">date in dd-mm-yyyy format</label>
	<input id="dd-mm-yyyy" pattern="((0[1-9]|1[0-9]|2[0-8])[./-](0[1-9]|1[0-2])|(29|30)[./-](0[13-9]|1[0-2])|31[./-](0[13578]|1[02]))[./-][0-9]{4}|29[./-]02[./-]([0-9]{2}(0[48]|[2468][048]|[13579][26])|([02468][048]|[13579][26])00)"/>
</p>
body {
	margin: 2em;
	max-width: 17em;
	font: 1em/1.4 Calibri, sans-serif;
}

label {
	display: block;
}

:invalid {
	outline: medium solid red;
}

blockquote {
	margin: 0;
}

blockquote p {
	font: italic 1.2em/1.5 Georgia;
	margin: 0;
	text-indent: -.4em;
}

blockquote cite {
	font-style: normal;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.