No problem. Assuming you have only one node inside your editor it is:
class_string = tinyMCE.activeEditor.getBody().firstChild.class;
class_string_array = class_string.split(" ");
for (i=0; i < class_string_array.length; i++){
if (class_string_array[i].search("border") !== -1) {
alert("class found!");
class_string_array[i] = "new_class";
class_string = class_string_array.join(" ");
tinyMCE.activeEditor.getBody().firstChild.setAttribute('class',class_string);
break;
}
}
It is much easier to use jQuery:
node = tinyMCE.activeEditor.getBody().firstChild;
if ( $(node).hasClass("border_xxx") ){ // need to check for explicit className
$(node).removeClass("border_xxx");
$(node).addClass("new_class");
}
EDIT: If you want to check for every node inside the content you will need to go through the body-domtree recursivly and check for each node:
function getTextNodesValues(tinymce,node) {
if ( $(node).hasClass("border_xxx") ){ // need to check explicit className
$(node).removeClass("border_xxx");
$(node).addClass("new_class");
}
for (var i=0; i<node.childNodes.length; i++) {
el = node.childNodes[i];
if ( $(node).hasClass("border_xxx") ){ // need to check explicit className
$(node).removeClass("border_xxx");
$(node).addClass("new_class");
}
if (el.childNodes.length > 0) getTextNodesValues(tinymce,el);
}
}
getTextNodesValues(tinymce, getTextNodesValues(tinymce,node) );
Should get you all Classes inside the Editor:
tinyMCE.activeEditor.dom.getClasses();
but it is not easy to replace them with that info.