JSFiddle - React, Tailwind, and code Playground
HTML
<div id="res">
</div>
JavaScript
$(function() {
test = [];
test[0] = "EQUAL CONTAINS EQUAL LESS_THAN"; //=> NOT OK
test[1] = "EQUAL EQUAL EQUAL"; // => OK
test[2] = "EQUAL"; // => OK
test[3] = "CONTAINS"; // => NOT OK
test[4] = "CONTAINS EQUAL"; // => NOT OK
test[5] = "EQUAL EQUAL EQUAL CONTAINS"; //=> NOT OK
tl = test.length
reg = /EQUAL\s?/;
out = ""
for (i = 0; i < tl; i++) {
temp = test[i].split(reg)
out+=test[i]+" => "+((temp.join('').length==0)?"OK":"NOT OK") + "<br/>"
}
$("#res").html(out);
})