JSFiddle - React, Tailwind, and code Playground
by oamiamgod
HTML
<input type="text" id="Text1" name="teest" />
<button onclick="checkReg2();">Check</button>
<div id="mainDiv"></div>
JavaScript
function checkReg2() {
var reg = /^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/g;
var txt = document.getElementById("Text1").value;
if (reg.test(txt)) {
document.getElementById("mainDiv").innerHTML = "<h1 style='color:green'>Correct</h1>";
} else {
document.getElementById("mainDiv").innerHTML = "<h1 style='color:red'>Wrong</h1>";
}
}