JSFiddle - React, Tailwind, and code Playground
JavaScript
console.log('This <is> a string to <use> to test the <regular> expression'.replace( /[^<>]+|<.*?>/g, function(val){
if(val.charAt(0) == '<' && val.charAt(val.length - 1) == '>') {
return val.slice(1,-1);
} else {
// Do whatever you want with val here
return val.toUpperCase();
}
} ));