JSFiddle - React, Tailwind, and code Playground
by fbfcn
JavaScript
value = '1-3,5,9-7'
var values = value.match(/(\d*-\d*)/g);
$.each(values, function () {
var val = this;
var match2 = val.match(/([0-9]+,?)/g);
if (parseInt(match2[0]) > parseInt(match2[1])) {
alert(false);
}
});