Basic product builder
Abstract a common function out:

var myFunction = function(myClass){
  $("#prevTex").removeClass (function (index, css) {
    return (css.match (/\btextc-\S+/g) || []).join(' ');});
  $("#prevTex").addClass(myClass);
});


Then apply it like so:

$(".black-sel").click(function(){ myFunction("textc-black"); });
$(".white-sel").click(function(){ myFunction("textc-white"); });
$(".red-sel").click(function(){ myFunction("textc-red"); });