jQuery removeClass wildcard

Solution 1:

The removeClass function takes a function argument since jQuery 1.4.

$("#hello").removeClass (function (index, className) {
    return (className.match (/(^|\s)color-\S+/g) || []).join(' ');
});

Live example: http://jsfiddle.net/xa9xS/1409/

Solution 2:

$('div').attr('class', function(i, c){
    return c.replace(/(^|\s)color-\S+/g, '');
});