JSFiddle - React, Tailwind, and code Playground
HTML
<div id="hello" class="color-red color-brown foo bar"></div>
JavaScript
var begin = 'color-';
function removeClassStartingWith(node, begin) {
node.removeClass (function (index, className) {
return (className.match ( new RegExp("\\b"+begin+"\\S+", "g") ) || []).join(' ');
});
}
removeClassStartingWith($('#hello'), 'color-r');
console.log($("#hello")[0].className);