JSFiddle - React, Tailwind, and code Playground
by Tintu Raju
HTML
<input type='text' id='myid'>
<input type='button' id='validate' onclick='validate();' value='validate'>
JavaScript
function validate(){
v = document.getElementById("myid").value;
var reg = /^\d+-\d+$/;
if(!reg.test(v))
alert('wrong format it should be like this 3-5');
else
alert('right format');
}