JSFiddle - React, Tailwind, and code Playground
HTML
<div id='output'></div>
JavaScript
var $str = "<SPAN STYLE="" >No Attachments.<BR></SPAN><SPAN style="font-weight: bold" >Reaction<SPAN STYLE="font-style:italic" >: After you deploy this unit, discard 1 card at random from your opponent’s hand.</SPAN>sdaf</SPAN>asdf";
// The array of regex patterns to look for
$format_search = [
/<SPAN STYLE="" >(.*?)\<\/SPAN>/ig,
/<SPAN\s*style="font-weight: bold" >(.*?)\<\/SPAN>/ig,
/<SPAN\s*style="font-style:italic" >(.*?)\<\/SPAN>/ig,
/\[u\](.*?)\[\/u\]/ig,
/<BR>/ig
]; // NOTE: No comma after the last entry
// The matching array of strings to replace matches with
$format_replace = [
'$1',
"<strong class='bbc'>$1</strong>",
"<em class='bbc'>$1</em>",
"<span style='text-decoration: underline;'>$1</span>",
"<br />"
];
// Perform the actual conversion
for (var i =0;i<$format_search.length;i++) {
$str = $str.replace($format_search[i], $format_replace[i]);
}
document.getElementById('output').innerHTML=$str;
console.log($str);