JSFiddle - React, Tailwind, and code Playground
HTML
<script>
//Есть HTML страница, в ней следующая часть:
var html= '<table border=1>\
<tr>\
<th class = caption2 > Текущий тариф </th>\
<td> 299 </td>\
</tr>\
<tr>\
<th class="caption2">\
Текущий баланс\
</th>\
<td class = "bad caption2"\
title = "Для включения услуги баланс должен быть > 0!">\
−100.33 <span class="currency">руб.</span>\
</td>\
</tr>\
<tr>\
<th class="caption2">\
Обещаный платёж\
</th>\
<td class = "caption2">\
100 <span class="currency">руб.</span>\
</td>\
</tr>\
<tr>\
<th class="caption2">\
Бонусных баллов\
</th>\
<td class = "good">\
77\
</td>\
</tr>\
</table>';
document.write(html);
</script>
CSS
.bad {
color: red;
}
.good {
color: green;
}
.currency {
color: blue;
}
JavaScript
var tmp = html.replace(/(<([^>]+)>)/ig,"") // remove tags
.replace(/\s/g, "" ); // inline
// Open console to see output
// 0!">
console.log(tmp);