JSFiddle - React, Tailwind, and code Playground

by bizamajig

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-' );

console.warn( $( "#hello" )[ 0 ].className );